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/RemoteSystemsTempFiles
docs/_build
dist

View File

@ -1,6 +1,17 @@
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)
------------------

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>`_ |
`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.
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
: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>
# See LICENSE for details.
VERSION = (0, 7, 0)
VERSION = (0, 7, 1)
__version__ = ".".join([str(s) for s in VERSION])
__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"
__author__ = "Ivan Kravets"

View File

@ -11,7 +11,7 @@ from time import sleep
from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
DefaultEnvironment, Exit)
from platformio.util import reset_serialport
from platformio.util import get_serialports, reset_serialport
env = DefaultEnvironment()
@ -164,9 +164,19 @@ AlwaysBuild(uploadeep)
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
set(COMMAND_LINE_TARGETS))
if is_uptarget and not env.subst("$UPLOAD_PORT"):
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
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 "
"--upload-port option.")
#
# Setup default targets

View File

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

View File

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

View File

@ -33,6 +33,8 @@ class LibraryManager(object):
def get_installed(self):
items = []
if not isdir(self.lib_dir):
return items
for item in listdir(self.lib_dir):
conf_path = join(self.lib_dir, item, self.CONFIG_NAME)
if isfile(conf_path):
@ -53,14 +55,13 @@ class LibraryManager(object):
if self.is_installed(name):
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)
if version else None)
try:
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)
finally:
remove(dlpath)

View File

@ -46,7 +46,11 @@ def get_lib_dir():
config = get_project_config()
if (config.has_section("platformio") and
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:
pass
return join(get_home_dir(), "lib")

View File

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

View File

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

View File

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