Merge branch 'release/v0.7.1'

This commit is contained in:
Ivan Kravets
2014-10-06 23:28:12 +03:00
14 changed files with 72 additions and 27 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@
examples/ide-eclipse/.metadata examples/ide-eclipse/.metadata
examples/ide-eclipse/RemoteSystemsTempFiles examples/ide-eclipse/RemoteSystemsTempFiles
docs/_build docs/_build
dist

View File

@@ -1,6 +1,17 @@
Release History Release History
=============== ===============
0.8.0 (?)
---------
0.7.1 (2014-10-06)
------------------
* Fixed bug with order for includes in conversation from INO/PDE to CPP
* Automatic detection of port on upload (`issue #15 <https://github.com/ivankravets/platformio/issues/15>`_)
* Fixed lib update crashing when no libs are installed (`issue #19 <https://github.com/ivankravets/platformio/issues/19>`_)
0.7.0 (2014-09-24) 0.7.0 (2014-09-24)
------------------ ------------------

View File

@@ -1,5 +1,5 @@
PlatformIO: A cross-platform code builder and library manager PlatformIO: A cross-platform code builder and library manager (Arduino, MSP430, ARM)
============================================================= ====================================================================================
`Website + Library Search <http://platformio.ikravets.com>`_ | `Website + Library Search <http://platformio.ikravets.com>`_ |
`Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ | `Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ |

View File

@@ -9,7 +9,7 @@ Library Manager
*PlatformIO Library Manager* allows you to organize external embedded libraries. *PlatformIO Library Manager* allows you to organize external embedded libraries.
You can search for new libraries via :ref:`Command Line <cmd_lib_search>` You can search for new libraries via :ref:`Command Line <cmd_lib_search>`
or `WebSite <http://platformio.ikravets.com>`_ interfaces. or `WebSite <http://platformio.ikravets.com/#!/lib>`_ interfaces.
You don't need to bother for finding the latest version of library. Due to 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. :ref:`cmd_lib_update` command you will have up-to-date external libraries.

View File

@@ -1,11 +1,12 @@
# Copyright (C) Ivan Kravets <me@ikravets.com> # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details. # See LICENSE for details.
VERSION = (0, 7, 0) VERSION = (0, 7, 1)
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"
__description__ = ("A cross-platform code builder and library manager") __description__ = ("A cross-platform code builder and library manager "
"(Arduino, MSP430, ARM)")
__url__ = "http://platformio.ikravets.com" __url__ = "http://platformio.ikravets.com"
__author__ = "Ivan Kravets" __author__ = "Ivan Kravets"

View File

@@ -11,7 +11,7 @@ from time import sleep
from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
DefaultEnvironment, Exit) DefaultEnvironment, Exit)
from platformio.util import reset_serialport from platformio.util import get_serialports, reset_serialport
env = DefaultEnvironment() env = DefaultEnvironment()
@@ -164,7 +164,17 @@ AlwaysBuild(uploadeep)
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) & is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
set(COMMAND_LINE_TARGETS)) set(COMMAND_LINE_TARGETS))
if is_uptarget and not env.subst("$UPLOAD_PORT"):
if is_uptarget:
# try autodetect upload port
if "UPLOAD_PORT" not in env:
for item in get_serialports():
if "VID:PID" in item['hwid']:
print "Auto-detected UPLOAD_PORT: %s" % item['port']
env['UPLOAD_PORT'] = item['port']
break
if "UPLOAD_PORT" not in env:
Exit("Please specify environment 'upload_port' or use global " Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.") "--upload-port option.")

View File

@@ -173,22 +173,29 @@ def ConvertInotoCpp(env):
continue continue
ino_contents = item.get_text_contents() ino_contents = item.get_text_contents()
# fetch prototypes re_includes = re.compile(r"^(#include\s+(?:\<|\")[^\r\n]+)",
regexp = re.compile( re.M | re.I)
includes = re_includes.findall(ino_contents)
prototypes = re.findall(
r"""^( r"""^(
(?:\s*[a-z_\d]+){1,2} # return type (?:\s*[a-z_\d]+){1,2} # return type
\s+[a-z_\d]+\s* # name of prototype \s+[a-z_\d]+\s* # name of prototype
\([a-z_,\.\*\&\[\]\s\d]*\) # args \([a-z_,\.\*\&\[\]\s\d]*\) # args
)\s*\{ # must end with { )\s*\{ # must end with {
""", """,
ino_contents,
re.X | re.M | re.I re.X | re.M | re.I
) )
prototypes = regexp.findall(ino_contents) # print includes, prototypes
# print prototypes
# disable previous includes
ino_contents = re_includes.sub(r"//\1", ino_contents)
# create new temporary C++ valid file # create new temporary C++ valid file
with open(cppfile, "w") as f: with open(cppfile, "w") as f:
f.write("#include <Arduino.h>\n") f.write("#include <Arduino.h>\n")
if includes:
f.write("%s\n" % "\n".join(includes))
if prototypes: if prototypes:
f.write("%s;\n" % ";\n".join(prototypes)) f.write("%s;\n" % ";\n".join(prototypes))
f.write("#line 1 \"%s\"\n" % basename(item.path)) f.write("#line 1 \"%s\"\n" % basename(item.path))

View File

@@ -140,9 +140,12 @@ def lib_show(name):
@cli.command("update", short_help="Update installed libraries") @cli.command("update", short_help="Update installed libraries")
def lib_update(): def lib_update():
lm = LibraryManager(get_lib_dir()) lm = LibraryManager(get_lib_dir())
lib_names = lm.get_installed()
versions = get_api_result("/lib/version/" + ",".join(lib_names))
lib_names = lm.get_installed()
if not lib_names:
return
versions = get_api_result("/lib/version/" + ",".join(lib_names))
for name in lib_names: for name in lib_names:
info = lm.get_info(name) info = lm.get_info(name)

View File

@@ -25,7 +25,10 @@ def cli(environment, target, upload_port):
raise UnknownEnvNames(", ".join(unknown)) raise UnknownEnvNames(", ".join(unknown))
for section in config.sections(): for section in config.sections():
if section[:4] != "env:": # skip main configuration section
if section == "platformio":
continue
elif section[:4] != "env:":
raise InvalidEnvName(section) raise InvalidEnvName(section)
envname = section[4:] envname = section[4:]

View File

@@ -33,6 +33,8 @@ class LibraryManager(object):
def get_installed(self): def get_installed(self):
items = [] items = []
if not isdir(self.lib_dir):
return items
for item in listdir(self.lib_dir): for item in listdir(self.lib_dir):
conf_path = join(self.lib_dir, item, self.CONFIG_NAME) conf_path = join(self.lib_dir, item, self.CONFIG_NAME)
if isfile(conf_path): if isfile(conf_path):
@@ -53,14 +55,13 @@ class LibraryManager(object):
if self.is_installed(name): if self.is_installed(name):
raise LibAlreadyInstalledError() raise LibAlreadyInstalledError()
_lib_dir = join(self.lib_dir, name)
if not isdir(_lib_dir):
makedirs(_lib_dir)
dlinfo = get_api_result("/lib/download/" + name, dict(version=version) dlinfo = get_api_result("/lib/download/" + name, dict(version=version)
if version else None) if version else None)
try: try:
dlpath = self.download(dlinfo['url'], gettempdir()) dlpath = self.download(dlinfo['url'], gettempdir())
_lib_dir = join(self.lib_dir, name)
if not isdir(_lib_dir):
makedirs(_lib_dir)
self.unpack(dlpath, _lib_dir) self.unpack(dlpath, _lib_dir)
finally: finally:
remove(dlpath) remove(dlpath)

View File

@@ -46,7 +46,11 @@ def get_lib_dir():
config = get_project_config() config = get_project_config()
if (config.has_section("platformio") and if (config.has_section("platformio") and
config.has_option("platformio", "lib_dir")): config.has_option("platformio", "lib_dir")):
return config.get("platformio", "lib_dir") lib_dir = config.get("platformio", "lib_dir")
if lib_dir.startswith("~"):
return expanduser(lib_dir)
else:
return lib_dir
except NotPlatformProject: except NotPlatformProject:
pass pass
return join(get_home_dir(), "lib") return join(get_home_dir(), "lib")

View File

@@ -1,5 +1,5 @@
click==3.3 click==3.3
colorama==0.3.1 colorama==0.3.1
pyserial==2.7 pyserial==2.7
requests==2.4.1 requests==2.4.3
scons==2.3.0 scons==2.3.0

View File

@@ -73,16 +73,20 @@ def install_pip():
def install_pypi_packages(packages): def install_pypi_packages(packages):
for p in packages: for pipargs in packages:
print (exec_python_cmd(["-m", "pip", "install", "-U"] + p.split())) print (exec_python_cmd(["-m", "pip", "install", "-U"] + pipargs))
def main(): def main():
steps = [ steps = [
("Fixing Windows %PATH% Environment", fix_winpython_pathenv, []), ("Fixing Windows %PATH% Environment", fix_winpython_pathenv, []),
("Installing Python Package Manager", install_pip, []), ("Installing Python Package Manager", install_pip, []),
("Installing PlatformIO and dependencies", install_pypi_packages, ("Installing PlatformIO and dependencies", install_pypi_packages, [
(["platformio", "--egg scons"],)), [["platformio"], [
"--egg",
"http://sourceforge.net/projects/scons/files/latest/download"
]]
])
] ]
if not IS_WINDOWS: if not IS_WINDOWS:

View File

@@ -15,7 +15,7 @@ deps =
isort isort
flake8 flake8
commands = commands =
pip install --egg scons pip install --egg http://sourceforge.net/projects/scons/files/latest/download
[testenv:docs] [testenv:docs]
deps = deps =