From e2795716f98a69fe68dc8805c6b52592e4e74265 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 22 Aug 2015 23:11:48 +0300 Subject: [PATCH] Generate "readme.txt" for project "lib" directory // Resolve #273 --- HISTORY.rst | 4 +++- docs/userguide/cmd_init.rst | 6 +++++- platformio/commands/init.py | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f80bab67..9d616f9f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -25,8 +25,10 @@ PlatformIO 2.0 * Updated ``tool-teensy`` for `Teensy `__ platform (`issue #268 `_) -* Added answer to FAQ when `Program "platformio" not found in PATH `_ +* Added FAQ answer when `Program "platformio" not found in PATH `_ (`issue #272 `_) +* Generate "readme.txt" for project "lib" directory + (`issue #273 `_) * Fixed includes list for Windows OS when generating project for `Eclipse IDE `__ (`issue #270 `_) * Fixed ``AttributeError: 'module' object has no attribute 'packages'`` diff --git a/docs/userguide/cmd_init.rst b/docs/userguide/cmd_init.rst index 33ee76ec..29fedc47 100644 --- a/docs/userguide/cmd_init.rst +++ b/docs/userguide/cmd_init.rst @@ -26,6 +26,10 @@ This command will create: * ``lib`` - a directory for the project specific (private) libraries. PlatformIO will compile them to static libraries and link to executable file +.. note:: + The source code of each library should be placed in separate directory. + For example, ``lib/private_lib/[here are source files]``. + Options ------- @@ -70,11 +74,11 @@ allows you to disable firmware auto-uploading by default. --env-prefix An environment prefix which will be used with pair in board type. - For example, the default environment name for ``teensy_31`` board will be ``[env:teensy_31]``. + Examples -------- diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 270eb2ea..75a263ed 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -77,6 +77,18 @@ def cli(project_dir, board, ide, disable_auto_uploading, env_prefix): 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(""" +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". +""") + if not isfile(project_file): copyfile(join(get_source_dir(), "projectconftpl.ini"), project_file)