Skip to content

Commit

Permalink
Merge branch 'release/v0.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Oct 6, 2014
2 parents 6404b02 + 466026b commit 8d491b4
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
examples/ide-eclipse/.metadata
examples/ide-eclipse/RemoteSystemsTempFiles
docs/_build
dist
11 changes: 11 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -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>`_ |
Expand Down
2 changes: 1 addition & 1 deletion docs/librarymanager/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions platformio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Copyright (C) Ivan Kravets <[email protected]>
# 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"
Expand Down
18 changes: 14 additions & 4 deletions platformio/builder/scripts/atmelavr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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()

Expand Down Expand Up @@ -164,9 +164,19 @@ def rpi_sysgpio(path, value):

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
Expand Down
15 changes: 11 additions & 4 deletions platformio/builder/tools/platformio.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,29 @@ def delete_tmpcpp(files):
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))
Expand Down
5 changes: 4 additions & 1 deletion platformio/commands/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
if not lib_names:
return

versions = get_api_result("/lib/version/" + ",".join(lib_names))
for name in lib_names:
info = lm.get_info(name)

Expand Down
5 changes: 4 additions & 1 deletion platformio/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down
9 changes: 5 additions & 4 deletions platformio/libmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def unpack(pkgpath, dest_dir):

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):
Expand All @@ -53,14 +55,13 @@ def install(self, name, version=None):
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)
Expand Down
6 changes: 5 additions & 1 deletion platformio/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
12 changes: 8 additions & 4 deletions scripts/get-platformio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 8d491b4

Please sign in to comment.