forked from platformio/platformio-core
Merge branch 'release/v2.5.0'
This commit is contained in:
15
HISTORY.rst
15
HISTORY.rst
@ -4,6 +4,19 @@ Release History
|
||||
PlatformIO 2.0
|
||||
--------------
|
||||
|
||||
2.5.0 (2015-12-08)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Improved code builder for parallel builds (up to 4 times faster than before)
|
||||
* Generate `.travis.yml <http://docs.platformio.org/en/latest/ci/travis.html>`__
|
||||
CI and `.gitignore` files for embedded projects by default
|
||||
(`issue #354 <https://github.com/platformio/platformio/issues/354>`_)
|
||||
* Removed prompt with "auto-uploading" from `platformio init <http://docs.platformio.org/en/latest/userguide/cmd_init.html>`__
|
||||
command and added ``--enable-auto-uploading`` option
|
||||
(`issue #352 <https://github.com/platformio/platformio/issues/352>`_)
|
||||
* Fixed incorrect behaviour of `platformio serialports monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`__
|
||||
in pair with PySerial 3.0
|
||||
|
||||
2.4.1 (2015-12-01)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -219,7 +232,7 @@ PlatformIO 2.0
|
||||
* Automatically detect upload port using VID:PID board settings
|
||||
(`issue #231 <https://github.com/platformio/platformio/issues/231>`_)
|
||||
* Improved detection of build changes
|
||||
* Avoided ``LibInstallDependencyError`` when more then 1 library is found
|
||||
* Avoided ``LibInstallDependencyError`` when more than 1 library is found
|
||||
(`issue #229 <https://github.com/platformio/platformio/issues/229>`_)
|
||||
|
||||
2.1.0 (2015-06-03)
|
||||
|
BIN
docs/_static/ci-travis-logo.png
vendored
Normal file
BIN
docs/_static/ci-travis-logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -23,12 +23,15 @@ Here are recent articles about PlatformIO:
|
||||
2015
|
||||
^^^^
|
||||
|
||||
* Dec 01, 2015 - **Tateno Yuichi** - `ESP8266 を CUI で開発する (Develop a ESP8266 in CUI, Japanese) <http://jaywiggins.com/platformio/arduino/avr/es8266/2015/09/30/platformio-investigation/>`_
|
||||
* Nov 29, 2015 - **Keith Hughes** - `Using PlatformIO for Embedded Projects <http://smartspacestuff.blogspot.com/2015/11/using-platformio-for-embedded-projects.html>`_
|
||||
* Nov 22, 2015 - **Michał Seroczyński** - `Using PlatformIO to get started with Arduino in CLion IDE <http://www.ches.pl/using-platformio-get-started-arduino-clion-ide/>`_
|
||||
* Nov 09, 2015 - **ÁLvaro García Gómez** - `Programar con Arduino "The good way" (Programming with Arduino "The good way", Spanish) <http://congdegnu.es/2015/11/09/programar-con-arduino-the-good-way/>`_
|
||||
* Nov 06, 2015 - **nocd5** - `PlatformIOでmbedをオフラインビルドしSTM32 Nucleoボードでmrubyを使う (Use mruby in the offline build for STM32 Nucleo board with mbed and PlatformIO, Japanese) <http://qiita.com/nocd5/items/d5fda776240f7e7c17eb>`_
|
||||
* Oct 21, 2015 - **Vittorio Zaccaria** - `Using a cheap STM32 Nucleo to teach remote sensor monitoring <http://www.vittoriozaccaria.net/blog/2015/10/21/using-a-cheap-stm32-nucleo-to-teach-remote-sensor-monitoring.html>`_
|
||||
* Oct 18, 2015 - **Nico Coetzee** - `First Arduino I2C Experience with PlatformIO <https://electronicventurer.wordpress.com/2015/10/18/first-arduino-i2c-experience/>`_
|
||||
* Oct 01, 2015 - **Mistan** - `Compile and Upload Arduino Sketch with PlatformIO for Raspberry Pi Running Arch Linux <http://tech.memoryimprintstudio.com/code-building-for-arduino-with-platformio-for-raspberry-pi-with-arch-linux/>`_
|
||||
* Sep 30, 2015 - **Jay Wiggins** - `PlatformIO Investigation <http://jaywiggins.com/platformio/arduino/avr/es8266/2015/09/30/platformio-investigation/>`_
|
||||
* Sep 01, 2015 - **Thomas P. Weldon, Ph.D.** - `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation <http://thomasweldon.com/tpw/courses/embeddsp/p00pcFrdmK64_eclipsePlatformioSetup.html>`_
|
||||
* Aug 08, 2015 - **Josh Glendenning** - `Armstrap Eagle and PlatformIO <http://isobit.io/2015/08/08/armstrap.html>`_
|
||||
* Aug 01, 2015 - **Russell Davis** - `PlatformIO on the Raspberry Pi <http://www.russelldavis.org/2015/08/01/platformio-on-the-raspberry-pi/>`_
|
||||
|
@ -14,6 +14,13 @@
|
||||
Travis CI
|
||||
=========
|
||||
|
||||
.. image:: ../_static/ci-travis-logo.png
|
||||
:target: https://docs.travis-ci.com/user/integration/platformio/
|
||||
|
||||
|
||||
**Travis CI** `officially supports <https://docs.travis-ci.com/user/integration/platformio/>`_
|
||||
**PlatformIO for Embedded Builds.**
|
||||
|
||||
`Travis CI <http://en.wikipedia.org/wiki/Travis_CI>`_ is an open-source hosted,
|
||||
distributed continuous integration service used to build and test projects
|
||||
hosted at `GitHub <http://en.wikipedia.org/wiki/GitHub>`_.
|
||||
|
@ -28,12 +28,21 @@ This software can be used with:
|
||||
Refer to the `Arduino Getting Started <http://arduino.cc/en/Guide/HomePage>`_
|
||||
page for Installation instructions.
|
||||
|
||||
.. contents::
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
More detailed information is located in PlatformIO blog:
|
||||
`Integration of PlatformIO library manager to Arduino IDE <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_.
|
||||
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
* `Integration of PlatformIO library manager to Arduino and Energia IDEs <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
|
||||
|
||||
See the full list with :ref:`articles`.
|
||||
|
||||
Screenshot
|
||||
----------
|
||||
|
||||
|
@ -34,6 +34,13 @@ Integration
|
||||
Using `Atom Packages <https://atom.io/docs/v1.0.2/using-atom-atom-packages>`_
|
||||
please install `platomformio <https://atom.io/packages/platomformio>`_ package.
|
||||
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
* `Arduino Development in Atom Editor <http://viget.com/extend/arduino-development-in-atom-editor>`_
|
||||
|
||||
See a full list with :ref:`articles`.
|
||||
|
||||
Screenshot
|
||||
----------
|
||||
|
||||
|
@ -57,6 +57,11 @@ There are 3 predefined targets for building:
|
||||
* ``PLATFORMIO_UPLOAD`` - build and upload (if no errors)
|
||||
* ``PLATFORMIO_CLEAN`` - clean compiled objects and etc.
|
||||
|
||||
.. warning::
|
||||
The libraries which are added, installed or used in the project
|
||||
after generating process wont be reflected in IDE. To fix it you
|
||||
need to reinitialize project using :ref:`cmd_init` (repeat it).
|
||||
|
||||
.. warning::
|
||||
PlatformIO generates empty project by default and **code auto-completion
|
||||
will not work!** To enable auto-completion please choose one of:
|
||||
@ -73,6 +78,14 @@ There are 3 predefined targets for building:
|
||||
Active discussion is located in
|
||||
`PlatformIO issue #132 <https://github.com/platformio/platformio/issues/132>`_.
|
||||
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
* `Using PlatformIO to get started with Arduino in CLion IDE <http://www.ches.pl/using-platformio-get-started-arduino-clion-ide/>`_
|
||||
* `Programar con Arduino "The good way" (Programming with Arduino "The good way", Spanish) <http://congdegnu.es/2015/11/09/programar-con-arduino-the-good-way/>`_
|
||||
|
||||
See a full list with :ref:`articles`.
|
||||
|
||||
Screenshot
|
||||
----------
|
||||
|
||||
|
@ -37,9 +37,6 @@ page for more detailed information.
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Project Generator
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Since PlatformIO 2.0 you can generate Eclipse compatible project using
|
||||
:option:`platformio init --ide` command. Please choose board type using
|
||||
:ref:`cmd_boards` command and run:
|
||||
@ -56,12 +53,19 @@ Then:
|
||||
2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``)
|
||||
3. Build project: ``Menu: Project > Build Project``.
|
||||
|
||||
.. warning::
|
||||
The libraries which are added, installed or used in the project
|
||||
after generating process wont be reflected in IDE. To fix it you
|
||||
need to reinitialize project using :ref:`cmd_init` (repeat it).
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
* `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
|
||||
* `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation <http://thomasweldon.com/tpw/courses/embeddsp/p00pcFrdmK64_eclipsePlatformioSetup.html>`_
|
||||
* `Learning Arduino GitHub Repository <http://www.trojanc.co.za/2015/07/11/learning-arduino-github-repository/>`_
|
||||
|
||||
See a full list with :ref:`articles`.
|
||||
|
||||
Screenshot
|
||||
----------
|
||||
|
@ -28,12 +28,21 @@ This software can be used with:
|
||||
Refer to the `Energia Getting Started <http://energia.nu/guide/>`_
|
||||
page for Installation instructions.
|
||||
|
||||
.. contents::
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
More detailed information is located in PlatformIO blog:
|
||||
`Integration of PlatformIO library manager to Energia IDE <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_.
|
||||
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
* `Integration of PlatformIO library manager to Arduino and Energia IDEs <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
|
||||
|
||||
See the full list with :ref:`articles`.
|
||||
|
||||
Screenshot
|
||||
-----------
|
||||
|
||||
|
@ -85,6 +85,11 @@ Then:
|
||||
.. image:: ../_static/ide-platformio-qtcreator-3.png
|
||||
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-3.png
|
||||
|
||||
.. warning::
|
||||
The libraries which are added, installed or used in the project
|
||||
after generating process wont be reflected in IDE. To fix it you
|
||||
need to reinitialize project using :ref:`cmd_init` (repeat it).
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -23,6 +23,8 @@ This software can be used with:
|
||||
* all available :ref:`platforms`
|
||||
* all available :ref:`frameworks`
|
||||
|
||||
.. contents::
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
@ -60,6 +62,13 @@ make firmware and upload it.
|
||||
If hotkey doesn't work for you, try to add this line
|
||||
``nnoremap <C-b> :make<CR>`` to ``~/.vimrc``
|
||||
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
* `コマンドラインでArduino開発 : vim + platformio (Arduino development at the command line: VIM + PlatformIO, Japanese) <http://qiita.com/caad1229/items/7b5fb47f034ae6e0baf2>`_
|
||||
|
||||
See a full list with :ref:`articles`.
|
||||
|
||||
Screenshot
|
||||
----------
|
||||
|
||||
|
@ -52,6 +52,11 @@ Then:
|
||||
2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``)
|
||||
3. Build project: ``Menu: Build > Build Solution``.
|
||||
|
||||
.. warning::
|
||||
The libraries which are added, installed or used in the project
|
||||
after generating process wont be reflected in IDE. To fix it you
|
||||
need to reinitialize project using :ref:`cmd_init` (repeat it).
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -99,11 +99,19 @@ Contents
|
||||
Platforms & Boards <platforms/index>
|
||||
frameworks/index
|
||||
|
||||
.. toctree::
|
||||
:caption: Library Manager
|
||||
:maxdepth: 2
|
||||
|
||||
Quickstart <librarymanager/index>
|
||||
User Guide <userguide/lib/index.rst>
|
||||
librarymanager/config
|
||||
librarymanager/creating
|
||||
|
||||
.. toctree::
|
||||
:caption: Integration
|
||||
:maxdepth: 2
|
||||
|
||||
librarymanager/index
|
||||
ci/index
|
||||
ide
|
||||
|
||||
|
@ -336,6 +336,6 @@ A list of example patterns. This field is predefined with default value:
|
||||
.. code-block:: javascript
|
||||
|
||||
"examples": [
|
||||
"[Ee]xamples/*/*.ini",
|
||||
"[Ee]xamples/*/*.ino",
|
||||
"[Ee]xamples/*/*.pde"
|
||||
]
|
||||
|
@ -14,10 +14,6 @@
|
||||
Library Manager
|
||||
===============
|
||||
|
||||
..
|
||||
|
||||
*"The missing library manager for development platforms"* [#]_
|
||||
|
||||
*PlatformIO Library Manager* allows you to organize external embedded libraries.
|
||||
You can search for new libraries via
|
||||
|
||||
@ -27,12 +23,4 @@ You can search for new libraries via
|
||||
You don't need to bother for finding the latest version of library. Due to
|
||||
:ref:`cmd_lib_update` command you will have up-to-date external libraries.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
config
|
||||
creating
|
||||
User Guide <../userguide/lib/index.rst>
|
||||
|
||||
.. [#] Inspired by `npm <https://www.npmjs.com/>`_ and `bower
|
||||
<http://bower.io>`_ package managers for web.
|
||||
.. image:: ../_static/platformio-demo-lib.gif
|
||||
|
@ -440,13 +440,17 @@ Example, specify own upload command for :ref:`platform_atmelavr`:
|
||||
# uncomment line below to see environment variables
|
||||
# print env.Dump()
|
||||
|
||||
See built-in examples of `PlatformIO build scripts <https://github.com/platformio/platformio/tree/develop/platformio/builder/scripts>`_.
|
||||
|
||||
* see built-in examples of `PlatformIO build scripts <https://github.com/platformio/platformio/tree/develop/platformio/builder/scripts>`_.
|
||||
* take a look on related users questions: `#351 <https://github.com/platformio/platformio/issues/351#issuecomment-161789165>`_,
|
||||
`#236 <https://github.com/platformio/platformio/issues/236#issuecomment-112038284>`_,
|
||||
`#247 <https://github.com/platformio/platformio/issues/247#issuecomment-118169728>`_
|
||||
|
||||
``targets``
|
||||
^^^^^^^^^^^
|
||||
|
||||
A list with targets which will be processed by :ref:`cmd_run` command by
|
||||
default. You can enter more then one target separated with "space". Which
|
||||
default. You can enter more than one target separated with "space". Which
|
||||
targets are supported is described in :option:`platformio run --target`.
|
||||
|
||||
**Tip!** You can use these targets like an option to
|
||||
|
@ -27,7 +27,7 @@ Usage
|
||||
Description
|
||||
-----------
|
||||
|
||||
Initialize new PlatformIO based project.
|
||||
Initialize new PlatformIO based project or update existing with new data.
|
||||
|
||||
|
||||
This command will create:
|
||||
@ -36,6 +36,8 @@ This command will create:
|
||||
* ``src`` - a source directory. Put your source files here
|
||||
* ``lib`` - a directory for the project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link to executable file
|
||||
* ``.travis.yml`` configuration file (template) for Continuous Integration
|
||||
with :ref:`ci_travis`
|
||||
|
||||
.. note::
|
||||
The source code of each library should be placed in separate directory.
|
||||
@ -74,12 +76,11 @@ A list with supported IDE is available within ``platformio init --help`` command
|
||||
Also, please look into :ref:`ide` page.
|
||||
|
||||
.. option::
|
||||
--disable-auto-uploading
|
||||
--enable-auto-uploading
|
||||
|
||||
If you initialise project with the specified
|
||||
:option:`platformio init --board`, then *PlatformIO*
|
||||
will create environment with enabled firmware auto-uploading. This option
|
||||
allows you to disable firmware auto-uploading by default.
|
||||
will create environment with enabled firmware auto-uploading.
|
||||
|
||||
.. option::
|
||||
--env-prefix
|
||||
@ -138,9 +139,6 @@ Examples
|
||||
|
||||
$ platformio init --board uno
|
||||
|
||||
Would you like to enable firmware auto-uploading when project is successfully built using `platformio run` command?
|
||||
Don't forget that you can upload firmware manually using `platformio run --target upload` command. [y/N]: y
|
||||
|
||||
The current working directory *** will be used for the new project.
|
||||
You can specify another project directory via
|
||||
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
|
||||
|
@ -59,7 +59,6 @@ Commands
|
||||
cmd_boards
|
||||
cmd_ci
|
||||
cmd_init
|
||||
platformio lib <lib/index>
|
||||
platformio platforms <platforms/index>
|
||||
cmd_run
|
||||
cmd_serialports
|
||||
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
VERSION = (2, 4, 1)
|
||||
VERSION = (2, 5, 0)
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -46,7 +46,7 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
|
||||
try:
|
||||
return self._handle_obsolate_command(name)
|
||||
except AttributeError:
|
||||
raise exception.UnknownCLICommand(name)
|
||||
raise click.UsageError('No such command "%s"' % name, ctx)
|
||||
return mod.cli
|
||||
|
||||
@staticmethod
|
||||
|
@ -41,8 +41,7 @@ from os import environ
|
||||
from os.path import isfile, join
|
||||
from time import time
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
|
||||
SConscript, SConscriptChdir, Variables)
|
||||
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, Variables
|
||||
|
||||
from platformio.exception import UnknownBoard
|
||||
|
||||
@ -141,10 +140,10 @@ if "BOARD" in env:
|
||||
)
|
||||
|
||||
if env['PLATFORM'] != env.get("BOARD_OPTIONS", {}).get("platform"):
|
||||
Exit("Error: '%s' platform doesn't support this board. "
|
||||
"Use '%s' platform instead." % (
|
||||
env['PLATFORM'],
|
||||
env.get("BOARD_OPTIONS", {}).get("platform")))
|
||||
env.Exit(
|
||||
"Error: '%s' platform doesn't support this board. "
|
||||
"Use '%s' platform instead." % (
|
||||
env['PLATFORM'], env.get("BOARD_OPTIONS", {}).get("platform")))
|
||||
|
||||
|
||||
for opt in ("LIB_IGNORE", "LIB_USE"):
|
||||
@ -158,16 +157,18 @@ if env.subst("$PIOPACKAGE_TOOLCHAIN"):
|
||||
env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin"))
|
||||
)
|
||||
|
||||
SConscriptChdir(0)
|
||||
SConscript(env.subst("$BUILD_SCRIPT"))
|
||||
env.SConscriptChdir(0)
|
||||
env.SConsignFile(join("$PIOENVS_DIR", ".sconsign.dblite"))
|
||||
env.SConscript("$BUILD_SCRIPT")
|
||||
|
||||
if environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT", None)):
|
||||
SConscript(environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT")))
|
||||
if environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT")):
|
||||
env.SConscript(
|
||||
environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT")))
|
||||
|
||||
if "envdump" in COMMAND_LINE_TARGETS:
|
||||
print env.Dump()
|
||||
Exit()
|
||||
env.Exit()
|
||||
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
print json.dumps(env.DumpIDEData())
|
||||
Exit()
|
||||
env.Exit()
|
||||
|
@ -26,13 +26,16 @@ the mbed Developer Community.
|
||||
http://mbed.org/
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
from binascii import crc32
|
||||
from os import getenv, walk
|
||||
from os.path import basename, isfile, join, normpath
|
||||
|
||||
from SCons.Script import DefaultEnvironment, Exit
|
||||
from SCons.Script import DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
@ -119,8 +122,10 @@ def add_mbedlib(libname, libar):
|
||||
lib_dir = join(env.subst("$PLATFORMFW_DIR"), "libs", libname)
|
||||
if not isfile(join(lib_dir, "TARGET_%s" % variant,
|
||||
"TOOLCHAIN_GCC_ARM", "lib%s.a" % libar)):
|
||||
Exit("Error: %s board doesn't support %s library!" %
|
||||
(env.get("BOARD"), libname))
|
||||
print (
|
||||
"Warning: %s board doesn't have native support for '%s' library!" %
|
||||
(env.get("BOARD"), libname), file=sys.stderr)
|
||||
return
|
||||
|
||||
env.Append(
|
||||
LIBPATH=[
|
||||
|
@ -99,8 +99,7 @@ def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
|
||||
_exclude_contents(build_dir, exclude)
|
||||
|
||||
# initialise project
|
||||
ctx.invoke(cmd_init, project_dir=build_dir, board=board,
|
||||
disable_auto_uploading=True)
|
||||
ctx.invoke(cmd_init, project_dir=build_dir, board=board)
|
||||
|
||||
# process project
|
||||
ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose)
|
||||
|
@ -45,21 +45,11 @@ def validate_boards(ctx, param, value): # pylint: disable=W0613
|
||||
callback=validate_boards)
|
||||
@click.option("--ide",
|
||||
type=click.Choice(ProjectGenerator.get_supported_ides()))
|
||||
@click.option("--disable-auto-uploading", is_flag=True)
|
||||
@click.option("--enable-auto-uploading", is_flag=True)
|
||||
@click.option("--env-prefix", default="")
|
||||
@click.pass_context
|
||||
def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
|
||||
disable_auto_uploading, env_prefix):
|
||||
|
||||
# ask about auto-uploading
|
||||
if board and app.get_setting("enable_prompts"):
|
||||
disable_auto_uploading = not click.confirm(
|
||||
"Would you like to enable firmware auto-uploading when project "
|
||||
"is successfully built using `platformio run` command? \n"
|
||||
"Don't forget that you can upload firmware manually using "
|
||||
"`platformio run --target upload` command."
|
||||
)
|
||||
click.echo("")
|
||||
enable_auto_uploading, env_prefix):
|
||||
|
||||
if project_dir == getcwd():
|
||||
click.secho("\nThe current working directory", fg="yellow", nl=False)
|
||||
@ -93,9 +83,108 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
|
||||
if not isdir(d):
|
||||
makedirs(d)
|
||||
|
||||
if not isfile(join(lib_dir, "readme.txt")):
|
||||
with open(join(lib_dir, "readme.txt"), "w") as f:
|
||||
f.write("""
|
||||
init_lib_readme(lib_dir)
|
||||
init_ci_conf(project_dir)
|
||||
init_cvs_ignore(project_dir)
|
||||
|
||||
if not isfile(project_file):
|
||||
copyfile(join(get_source_dir(), "projectconftpl.ini"),
|
||||
project_file)
|
||||
|
||||
if board:
|
||||
fill_project_envs(
|
||||
ctx, project_file, board, enable_auto_uploading, env_prefix,
|
||||
ide is not None
|
||||
)
|
||||
|
||||
if ide:
|
||||
if not board:
|
||||
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 lint)"
|
||||
" 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.generate()
|
||||
|
||||
click.secho(
|
||||
"\nProject has been successfully initialized!\nUseful commands:\n"
|
||||
"`platformio run` - process/build project from the current "
|
||||
"directory\n"
|
||||
"`platformio run --target upload` or `platformio run -t upload` "
|
||||
"- upload firmware to embedded board\n"
|
||||
"`platformio run --target clean` - clean project (remove compiled "
|
||||
"files)\n"
|
||||
"`platformio run --help` - additional information",
|
||||
fg="green"
|
||||
)
|
||||
|
||||
|
||||
def fill_project_envs( # pylint: disable=too-many-arguments,too-many-locals
|
||||
ctx, project_file, board_types, enable_auto_uploading,
|
||||
env_prefix, force_download):
|
||||
builtin_boards = get_boards()
|
||||
content = []
|
||||
used_envs = []
|
||||
used_platforms = []
|
||||
|
||||
with open(project_file) as f:
|
||||
used_envs = [l.strip() for l in f.read().splitlines() if
|
||||
l.strip().startswith("[env:")]
|
||||
|
||||
for type_ in board_types:
|
||||
data = builtin_boards[type_]
|
||||
used_platforms.append(data['platform'])
|
||||
env_name = "[env:%s%s]" % (env_prefix, type_)
|
||||
|
||||
if env_name in used_envs:
|
||||
continue
|
||||
|
||||
content.append("")
|
||||
content.append(env_name)
|
||||
content.append("platform = %s" % data['platform'])
|
||||
|
||||
# find default framework for board
|
||||
frameworks = data.get("frameworks")
|
||||
if frameworks:
|
||||
content.append("framework = %s" % frameworks[0])
|
||||
|
||||
content.append("board = %s" % type_)
|
||||
if enable_auto_uploading:
|
||||
content.append("targets = upload")
|
||||
|
||||
if force_download and used_platforms:
|
||||
_install_dependent_platforms(ctx, used_platforms)
|
||||
|
||||
if not content:
|
||||
return
|
||||
|
||||
with open(project_file, "a") as f:
|
||||
content.append("")
|
||||
f.write("\n".join(content))
|
||||
|
||||
|
||||
def _install_dependent_platforms(ctx, platforms):
|
||||
installed_platforms = PlatformFactory.get_platforms(installed=True).keys()
|
||||
if set(platforms) <= set(installed_platforms):
|
||||
return
|
||||
ctx.invoke(
|
||||
cli_platforms_install,
|
||||
platforms=list(set(platforms) - set(installed_platforms))
|
||||
)
|
||||
|
||||
|
||||
def init_lib_readme(lib_dir):
|
||||
if isfile(join(lib_dir, "readme.txt")):
|
||||
return
|
||||
with open(join(lib_dir, "readme.txt"), "w") as f:
|
||||
f.write("""
|
||||
This directory is intended for the project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link to executable file.
|
||||
|
||||
@ -135,77 +224,81 @@ http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
||||
|
||||
""")
|
||||
|
||||
if not isfile(project_file):
|
||||
copyfile(join(get_source_dir(), "projectconftpl.ini"),
|
||||
project_file)
|
||||
|
||||
if board:
|
||||
fill_project_envs(
|
||||
ctx, project_file, board, disable_auto_uploading, env_prefix)
|
||||
|
||||
if ide:
|
||||
pg = ProjectGenerator(project_dir, ide, board[0] if board else None)
|
||||
pg.generate()
|
||||
|
||||
click.secho(
|
||||
"\nProject has been successfully initialized!\nUseful commands:\n"
|
||||
"`platformio run` - process/build project from the current "
|
||||
"directory\n"
|
||||
"`platformio run --target upload` or `platformio run -t upload` "
|
||||
"- upload firmware to embedded board\n"
|
||||
"`platformio run --target clean` - clean project (remove compiled "
|
||||
"files)",
|
||||
fg="green"
|
||||
)
|
||||
|
||||
|
||||
def fill_project_envs(ctx, project_file, board_types, disable_auto_uploading,
|
||||
env_prefix):
|
||||
builtin_boards = get_boards()
|
||||
content = []
|
||||
used_envs = []
|
||||
used_platforms = []
|
||||
|
||||
with open(project_file) as f:
|
||||
used_envs = [l.strip() for l in f.read().splitlines() if
|
||||
l.strip().startswith("[env:")]
|
||||
|
||||
for type_ in board_types:
|
||||
data = builtin_boards[type_]
|
||||
used_platforms.append(data['platform'])
|
||||
env_name = "[env:%s%s]" % (env_prefix, type_)
|
||||
|
||||
if env_name in used_envs:
|
||||
continue
|
||||
|
||||
content.append("")
|
||||
content.append(env_name)
|
||||
content.append("platform = %s" % data['platform'])
|
||||
|
||||
# find default framework for board
|
||||
frameworks = data.get("frameworks")
|
||||
if frameworks:
|
||||
content.append("framework = %s" % frameworks[0])
|
||||
|
||||
content.append("board = %s" % type_)
|
||||
content.append("%stargets = upload" % ("# " if disable_auto_uploading
|
||||
else ""))
|
||||
|
||||
_install_dependent_platforms(ctx, used_platforms)
|
||||
|
||||
if not content:
|
||||
def init_ci_conf(project_dir):
|
||||
if isfile(join(project_dir, ".travis.yml")):
|
||||
return
|
||||
|
||||
with open(project_file, "a") as f:
|
||||
content.append("")
|
||||
f.write("\n".join(content))
|
||||
with open(join(project_dir, ".travis.yml"), "w") as f:
|
||||
f.write("""# Continuous Integration (CI) is the practice, in software
|
||||
# engineering, of merging all developer working copies with a shared mainline
|
||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
||||
#
|
||||
# Documentation:
|
||||
#
|
||||
# * Travis CI Embedded Builds with PlatformIO
|
||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
||||
#
|
||||
# * PlatformIO integration with Travis CI
|
||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
||||
#
|
||||
# * User Guide for `platformio ci` command
|
||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
||||
#
|
||||
#
|
||||
# Please choice one of the following templates (proposed below) and uncomment
|
||||
# it (remove "# " before each line) or use own configuration according to the
|
||||
# Travis CI documentation (see above).
|
||||
#
|
||||
|
||||
|
||||
def _install_dependent_platforms(ctx, platforms):
|
||||
installed_platforms = PlatformFactory.get_platforms(installed=True).keys()
|
||||
if set(platforms) <= set(installed_platforms):
|
||||
#
|
||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
||||
#
|
||||
|
||||
# language: python
|
||||
# python:
|
||||
# - "2.7"
|
||||
#
|
||||
# sudo: false
|
||||
# cache:
|
||||
# directories:
|
||||
# - "~/.platformio"
|
||||
#
|
||||
# install:
|
||||
# - pip install -U platformio
|
||||
#
|
||||
# script:
|
||||
# - platformio run
|
||||
|
||||
|
||||
#
|
||||
# Template #2: The project is intended to by used as a library with examples
|
||||
#
|
||||
|
||||
# language: python
|
||||
# python:
|
||||
# - "2.7"
|
||||
#
|
||||
# sudo: false
|
||||
# cache:
|
||||
# directories:
|
||||
# - "~/.platformio"
|
||||
#
|
||||
# env:
|
||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
||||
#
|
||||
# install:
|
||||
# - pip install -U platformio
|
||||
#
|
||||
# script:
|
||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
||||
""")
|
||||
|
||||
|
||||
def init_cvs_ignore(project_dir):
|
||||
if isfile(join(project_dir, ".gitignore")):
|
||||
return
|
||||
ctx.invoke(
|
||||
cli_platforms_install,
|
||||
platforms=list(set(platforms) - set(installed_platforms))
|
||||
)
|
||||
with open(join(project_dir, ".gitignore"), "w") as f:
|
||||
f.write(".pioevs")
|
||||
|
@ -159,7 +159,7 @@ def lib_install_dependency(ctx, data):
|
||||
ctx.invoke(lib_install, libid=[result['items'][0]['id']])
|
||||
else:
|
||||
click.secho(
|
||||
"Conflict: More then one dependent libraries have been found "
|
||||
"Conflict: More than one dependent libraries have been found "
|
||||
"by request %s:" % json.dumps(data), fg="red")
|
||||
|
||||
echo_liblist_header()
|
||||
|
@ -57,10 +57,10 @@ if int(PYSERIAL_VERSION[0]) == 3:
|
||||
help="Enable RTS/CTS flow control, default=Off")
|
||||
@click.option("--xonxoff", is_flag=True,
|
||||
help="Enable software flow control, default=Off")
|
||||
@click.option("--rts", default="0", type=click.Choice(["0", "1"]),
|
||||
help="Set initial RTS line state, default=0")
|
||||
@click.option("--dtr", default="0", type=click.Choice(["0", "1"]),
|
||||
help="Set initial DTR line state, default=0")
|
||||
@click.option("--rts", default=None, type=click.Choice(["0", "1"]),
|
||||
help="Set initial RTS line state")
|
||||
@click.option("--dtr", default=None, type=click.Choice(["0", "1"]),
|
||||
help="Set initial DTR line state")
|
||||
@click.option("--encoding", default="UTF-8",
|
||||
help="Set the encoding for the serial port (e.g. hexlify, "
|
||||
"Latin1, UTF-8), default: UTF-8")
|
||||
|
@ -32,7 +32,6 @@ def cli():
|
||||
fg="yellow")
|
||||
|
||||
cmds = (
|
||||
["pip", "install", "--upgrade", "pip", "setuptools"],
|
||||
["pip", "install", "--upgrade", "platformio"],
|
||||
["platformio", "--version"]
|
||||
)
|
||||
@ -60,7 +59,11 @@ def cli():
|
||||
if not r:
|
||||
raise exception.UpgradeError(
|
||||
"\n".join([str(cmd), str(e)]))
|
||||
if ("Permission denied" in r['err'] and
|
||||
permission_errors = (
|
||||
"permission denied",
|
||||
"not permitted"
|
||||
)
|
||||
if (any([m in r['err'].lower() for m in permission_errors]) and
|
||||
"windows" not in util.get_systype()):
|
||||
click.secho("""
|
||||
-----------------
|
||||
@ -68,7 +71,7 @@ Permission denied
|
||||
-----------------
|
||||
You need the `sudo` permission to install Python packages. Try
|
||||
|
||||
> sudo platformio upgrade
|
||||
> sudo pip install -U platformio
|
||||
|
||||
WARNING! Don't use `sudo` for the rest PlatformIO commands.
|
||||
""", fg="yellow", err=True)
|
||||
|
@ -48,10 +48,11 @@ class PlatformNotInstalledYet(PlatformioException):
|
||||
"Use `platformio platforms install` command"
|
||||
|
||||
|
||||
class UnknownCLICommand(PlatformioException):
|
||||
class BoardNotDefined(PlatformioException):
|
||||
|
||||
MESSAGE = "Unknown command '%s'. Please use `platformio --help`"\
|
||||
" to see all available commands"
|
||||
MESSAGE = "You need to specify board type using `-b` or `--board` "\
|
||||
"option. Supported boards list is available via "\
|
||||
" `platformio boards` command"
|
||||
|
||||
|
||||
class UnknownBoard(PlatformioException):
|
||||
@ -201,6 +202,7 @@ class UpgradeError(PlatformioException):
|
||||
|
||||
MESSAGE = """%s
|
||||
|
||||
* Upgrade using `pip install -U platformio`
|
||||
* Try different installation/upgrading steps:
|
||||
http://docs.platformio.org/en/latest/installation.html
|
||||
"""
|
||||
|
@ -20,12 +20,12 @@ from os.path import abspath, basename, expanduser, isdir, join, relpath
|
||||
import bottle
|
||||
import click
|
||||
|
||||
from platformio import util
|
||||
from platformio import exception, util
|
||||
|
||||
|
||||
class ProjectGenerator(object):
|
||||
|
||||
def __init__(self, project_dir, ide, board=None):
|
||||
def __init__(self, project_dir, ide, board):
|
||||
self.project_dir = project_dir
|
||||
self.ide = ide
|
||||
self.board = board
|
||||
@ -50,7 +50,7 @@ class ProjectGenerator(object):
|
||||
data = {"env_name": section[4:]}
|
||||
for k, v in config.items(section):
|
||||
data[k] = v
|
||||
if self.board and self.board == data.get("board"):
|
||||
if self.board == data.get("board"):
|
||||
break
|
||||
return data
|
||||
|
||||
@ -68,16 +68,15 @@ class ProjectGenerator(object):
|
||||
["platformio", "-f", "run", "-t", "idedata",
|
||||
"-e", envdata['env_name'], "-d", self.project_dir]
|
||||
)
|
||||
|
||||
if result['returncode'] != 0 or '"includes":' not in result['out']:
|
||||
return data
|
||||
raise exception.PlatformioException(
|
||||
"\n".join([result['out'], result['err']]))
|
||||
|
||||
output = result['out']
|
||||
try:
|
||||
start_index = output.index('\n{"')
|
||||
stop_index = output.rindex('}')
|
||||
data = json.loads(output[start_index + 1:stop_index + 1])
|
||||
except ValueError:
|
||||
pass
|
||||
start_index = output.index('\n{"')
|
||||
stop_index = output.rindex('}')
|
||||
data = json.loads(output[start_index + 1:stop_index + 1])
|
||||
|
||||
return data
|
||||
|
||||
|
@ -141,8 +141,8 @@ def after_upgrade(ctx):
|
||||
(click.style("follow", fg="cyan"),
|
||||
click.style("https://twitter.com/PlatformIO_Org", fg="cyan"))
|
||||
)
|
||||
click.echo("- %s us a star on GitHub > %s" % (
|
||||
click.style("give", fg="cyan"),
|
||||
click.echo("- %s it on GitHub! > %s" % (
|
||||
click.style("star", fg="cyan"),
|
||||
click.style("https://github.com/platformio/platformio", fg="cyan")
|
||||
))
|
||||
click.echo("*" * terminal_width)
|
||||
|
@ -15,6 +15,7 @@
|
||||
import os
|
||||
import re
|
||||
from imp import load_source
|
||||
from multiprocessing import cpu_count
|
||||
from os.path import isdir, isfile, join
|
||||
|
||||
import click
|
||||
@ -389,6 +390,8 @@ class BasePlatform(object):
|
||||
[
|
||||
"scons",
|
||||
"-Q",
|
||||
"-j %d" % self.get_job_nums(),
|
||||
"--warn=no-no-parallel-support",
|
||||
"-f", join(util.get_source_dir(), "builder", "main.py")
|
||||
] + variables + targets,
|
||||
stdout=util.AsyncPipe(self.on_run_out),
|
||||
@ -432,3 +435,10 @@ class BasePlatform(object):
|
||||
self._last_echo_line = line
|
||||
|
||||
click.secho(line, fg=fg, err=level < 3)
|
||||
|
||||
@staticmethod
|
||||
def get_job_nums():
|
||||
try:
|
||||
return cpu_count()
|
||||
except NotImplementedError:
|
||||
return 1
|
||||
|
11
setup.py
11
setup.py
@ -71,10 +71,9 @@ setup(
|
||||
"Topic :: Software Development :: Build Tools",
|
||||
"Topic :: Software Development :: Compilers"
|
||||
],
|
||||
keywords=(
|
||||
"iot builder library manager embedded development ide continuous "
|
||||
"integration atmel avr sam espressif esp freescale kinetis nordic "
|
||||
"nrf51 nxp lpc silicon labs efm32 st stm32 ti msp430 tiva teensy "
|
||||
"arduino mbed libopencm3"
|
||||
)
|
||||
keywords=[
|
||||
"iot", "build tool", "compiler", "builder", "library manager",
|
||||
"embedded", "ci", "continuous integration", "arduino", "mbed",
|
||||
"framework", "ide", "ide integration", "library.json"
|
||||
]
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ from os import makedirs, getcwd
|
||||
from os.path import getsize, isdir, isfile, join
|
||||
|
||||
from platformio.commands.init import cli
|
||||
from platformio import exception, util
|
||||
from platformio import util
|
||||
|
||||
|
||||
def validate_pioproject(pioproject_dir):
|
||||
@ -53,8 +53,7 @@ def test_init_special_board(platformio_setup, clirunner, validate_cliresult):
|
||||
expected_result = [
|
||||
("platform", str(uno['platform'])),
|
||||
("framework", str(uno['frameworks'][0])),
|
||||
("board", "uno"),
|
||||
("targets", "upload")
|
||||
("board", "uno")
|
||||
]
|
||||
|
||||
assert config.has_section("env:uno")
|
||||
@ -62,18 +61,19 @@ def test_init_special_board(platformio_setup, clirunner, validate_cliresult):
|
||||
set(config.items("env:uno")))) == 0
|
||||
|
||||
|
||||
def test_init_disable_auto_uploading(platformio_setup, clirunner,
|
||||
validate_cliresult):
|
||||
def test_init_enable_auto_uploading(platformio_setup, clirunner,
|
||||
validate_cliresult):
|
||||
with clirunner.isolated_filesystem():
|
||||
result = clirunner.invoke(cli,
|
||||
["-b", "uno", "--disable-auto-uploading"])
|
||||
["-b", "uno", "--enable-auto-uploading"])
|
||||
validate_cliresult(result)
|
||||
validate_pioproject(getcwd())
|
||||
config = util.get_project_config()
|
||||
expected_result = [
|
||||
("platform", "atmelavr"),
|
||||
("framework", "arduino"),
|
||||
("board", "uno")
|
||||
("board", "uno"),
|
||||
("targets", "upload")
|
||||
]
|
||||
assert config.has_section("env:uno")
|
||||
assert len(set(expected_result).symmetric_difference(
|
||||
|
Reference in New Issue
Block a user