From ea71a24e6d2f8db98942d983b04713a751838031 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 21 Jun 2014 22:44:57 +0300 Subject: [PATCH 01/25] Preparation for the first stable/production release --- HISTORY.rst | 6 +++++- platformio/__init__.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f721c4c469..14f6ca9690 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,9 +1,13 @@ Release History =============== -0.3.0 (2014-06-21) +1.0.0 (?) --------- + +0.3.0 (2014-06-21) +------------------ + * Allowed to pass multiple "SomePlatform" to install/uninstall commands * Added "IDE Integration" section to README with Eclipse project examples * Created auto installer script for *PlatformIO* (`issue #3 `_) diff --git a/platformio/__init__.py b/platformio/__init__.py index 6ad01aad28..01219250a7 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (0, 3, 0) +VERSION = (1, 0, "0-dev") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From a8112c2f37bdc7608d81811ac987d793cc25a4eb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 21 Jun 2014 23:04:33 +0300 Subject: [PATCH 02/25] Fixed auto-installer for Windows OS (bug with %PATH% customisations) --- HISTORY.rst | 5 +++++ platformio/__main__.py | 2 +- scripts/get-platformio.py | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 14f6ca9690..eeba00ab5e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,11 @@ Release History 1.0.0 (?) --------- +0.3.1 (2014-06-21) +------------------ + +* Fixed auto-installer for Windows OS (bug with %PATH% customisations) + 0.3.0 (2014-06-21) ------------------ diff --git a/platformio/__main__.py b/platformio/__main__.py index 3b9be17444..f1b052f82b 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -35,7 +35,7 @@ def get_command(self, ctx, name): @command(cls=PlatformioCLI) -@version_option(__version__, "platformio") +@version_option(__version__, prog_name="platformio") def cli(): pass diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py index 79bf85d748..aff8ba6c48 100644 --- a/scripts/get-platformio.py +++ b/scripts/get-platformio.py @@ -25,6 +25,8 @@ def fix_winpython_pathenv(): # took these lines from the native "win_add2path.py" pythonpath = os.path.dirname(CURINTERPRETER_PATH) scripts = os.path.join(pythonpath, "Scripts") + if not os.path.isdir(scripts): + os.makedirs(scripts) with winreg.CreateKey(winreg.HKEY_CURRENT_USER, u"Environment") as key: try: From 586868b2db4cd20c55694e2f71a0a866fd1d0123 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 25 Jun 2014 16:00:21 +0300 Subject: [PATCH 03/25] Added alternative "Quick-Install" version with only one command for Mac/Linux user --- README.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rst b/README.rst index f89eed60c2..fcae86df55 100644 --- a/README.rst +++ b/README.rst @@ -127,6 +127,13 @@ Then run the following (which may require administrator access): $ python get-platformio.py +An alternative short version for *Mac/Linux* users: + +.. code-block:: bash + + $ curl -L http://bit.ly/1lpanta | python + + On *Windows OS* it may look like: .. code-block:: bash From 5fa2732e0210824aeaba316a72e658f8f22123f2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 3 Jul 2014 18:46:01 +0300 Subject: [PATCH 04/25] Retested with click 2.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3c510e9637..9d579e6985 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -click==2.1 +click==2.3 colorama==0.3.1 pyserial==2.7 requests==2.3.0 From 73a84cb86a19eedfa49759390515a779fd98d3a3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 13 Jul 2014 21:20:10 +0300 Subject: [PATCH 05/25] Added "Embedded Platform Boards" section with pre-configured settings for most popular boards --- README.rst | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/README.rst b/README.rst index fcae86df55..83a7484168 100644 --- a/README.rst +++ b/README.rst @@ -70,6 +70,60 @@ IDE Integration * [Eclipse] `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_ +Embedded Platform Boards +------------------------ + +**PlatformIO** has pre-configured settings for most popular platform boards. You +have no need to specify in ``platformio.ini`` type or frequency of MCU, upload +protocol or etc. Please use ``board`` option (for +`example `_). + + +Platform ``atmelavr`` +~~~~~~~~~~~~~~~~~~~~~ + +* ``diecimilaatmega168`` Arduino Duemilanove or Diecimila (ATmega168) +* ``diecimilaatmega328`` Arduino Duemilanove or Diecimila (ATmega328) +* ``fio`` Arduino Fio +* ``leonardo`` Arduino Leonard +* ``LilyPadUSB`` Arduino LilyPad USB +* ``lilypadatmega168`` Arduino LilyPad (ATmega168) +* ``lilypadatmega328`` Arduino LilyPad (ATmega328) +* ``megaatmega1280`` Arduino Mega (ATmega1280) +* ``megaatmega2560`` Arduino Mega (ATmega2560) +* ``megaADK`` Arduino Mega ADK +* ``micro`` Arduino Micro +* ``miniatmega168`` Arduino Mini (ATmega168) +* ``miniatmega328`` Arduino Mini (ATmega328) +* ``nanoatmega168`` Arduino Nano (ATmega168) +* ``nanoatmega328`` Arduino Nano (ATmega328) +* ``pro8MHzatmega168`` Arduino Pro or Pro Mini (ATmega168, 3.3V, 8MHz) +* ``pro16MHzatmega168`` Arduino Pro or Pro Mini (ATmega168, 5V, 16MHz) +* ``pro8MHzatmega328`` Arduino Pro or Pro Mini (ATmega328, 3.3V, 8MHz) +* ``pro16MHzatmega328`` Arduino Pro or Pro Mini (ATmega328, 5V, 16MHz) +* ``uno`` Arduino Uno + + +Platform ``timsp430`` +~~~~~~~~~~~~~~~~~~~~~ + +* ``lpmsp430g2231`` TI LaunchPad MSP430 (msp430g2231) +* ``lpmsp430g2452`` TI LaunchPad MSP430 (msp430g2452) +* ``lpmsp430g2553`` TI LaunchPad MSP430 (msp430g2553) +* ``lpmsp430f5529`` TI LaunchPad MSP430 (msp430f5529, 16MHz) +* ``lpmsp430f5529_25`` TI LaunchPad MSP430 (msp430f5529, 25MHz) +* ``lpmsp430fr5969`` TI LaunchPad MSP430 (msp430fr5969) +* ``lpmsp430fr5739`` TI FraunchPad MSP430 (msp430fr5739) + + +Platform ``titiva`` +~~~~~~~~~~~~~~~~~~~ + +* ``lplm4f120h5qr`` TI Stellaris LM4F120 LaunchPad +* ``lptm4c1230c3pm`` TI Tiva C Series TM4C123G LaunchPad +* ``lptm4c1294ncpdt`` TI Tiva C Series TM4C1294 Connected LaunchPad + + Python & OS Support ------------------- From 015436eb6361ea888b7af19053584bf3360f7b3c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 22 Jul 2014 20:27:23 +0300 Subject: [PATCH 06/25] Retested with Click 2.4 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9d579e6985..7e3416da32 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -click==2.3 +click==2.4 colorama==0.3.1 pyserial==2.7 requests==2.3.0 From b41d453eecf8bc755512474495ce3635ff006082 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Jul 2014 22:29:32 +0300 Subject: [PATCH 07/25] Implemented "$ platformio serialports" command --- platformio/builder/tools/platformio.py | 16 ---------------- platformio/commands/serialports.py | 17 +++++++++++++++++ platformio/exception.py | 5 +++++ platformio/util.py | 24 ++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 platformio/commands/serialports.py diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index fc8aa0b666..cc9ca226a1 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -2,11 +2,8 @@ # See LICENSE for details. import re -from os import listdir, walk from os.path import isdir, isfile, join -from time import sleep -from serial import Serial def BuildLibrary(env, variant_dir, library_dir): @@ -116,18 +113,6 @@ def ParseBoardOptions(env, path, name): return data -def ResetDevice(env): - """ Pulse the DTR line and flush serial buffer """ - s = Serial(env.subst("$UPLOAD_PORT")) - s.flushInput() - s.setDTR(False) - s.setRTS(False) - sleep(0.1) - s.setDTR(True) - s.setRTS(True) - s.close() - - def exists(_): return True @@ -140,5 +125,4 @@ def generate(env): env.AddMethod(GetDependentLibraries) env.AddMethod(VariantDirRecursive) env.AddMethod(ParseBoardOptions) - env.AddMethod(ResetDevice) return env diff --git a/platformio/commands/serialports.py b/platformio/commands/serialports.py new file mode 100644 index 0000000000..79b3d67dd9 --- /dev/null +++ b/platformio/commands/serialports.py @@ -0,0 +1,17 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from click import command, echo, secho + +from platformio.util import get_serialports + + +@command("serialports", short_help="List Serial ports") +def cli(): + + for item in get_serialports(): + secho(item['port'], fg="cyan") + echo("----------") + echo("Hardware ID: %s" % item['hwid']) + echo("Description: %s" % item['description']) + echo("") diff --git a/platformio/exception.py b/platformio/exception.py index e58b35b3d9..9fe41d1ea9 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -85,3 +85,8 @@ class ProjectInitialized(PlatformioException): class ProjectEnvsNotAvaialable(PlatformioException): MESSAGE = "Please setup environments in `platformio.ini` file." + + +class GetSerialPortsError(PlatformioException): + + MESSAGE = "No implementation for your platform ('%s') available" diff --git a/platformio/util.py b/platformio/util.py index 87168a6fe5..a3ad8a1104 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -2,11 +2,14 @@ # See LICENSE for details. from os import getcwd, listdir, utime +from os import name as os_name from os.path import dirname, expanduser, isfile, join, realpath from platform import architecture, system from subprocess import PIPE, Popen +from time import sleep from platformio.exception import NotPlatformProject +from serial import Serial try: from configparser import ConfigParser @@ -57,3 +60,24 @@ def exec_command(args): p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell) out, err = p.communicate() return dict(out=out.strip(), err=err.strip()) + + +def reset_serialport(port): + s = Serial(port) + s.flushInput() + s.setDTR(False) + s.setRTS(False) + sleep(0.1) + s.setDTR(True) + s.setRTS(True) + s.close() + + +def get_serialports(): + if os_name == "nt": + from serial.tools.list_ports_windows import comports + elif os_name == "posix": + from serial.tools.list_ports_posix import comports + else: + raise GetSerialPortsError(os_name) + return[{"port": p, "description": d, "hwid": h} for p, d, h in comports()] From c0da671efea7efbff38eaae06bb6190f7091f0c4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Jul 2014 22:33:29 +0300 Subject: [PATCH 08/25] Allowed special build flags only for "src" files via "SRCBUILD_FLAGS" or global environment "export $PIOSRCBUILD_FLAGS" --- platformio/builder/main.py | 1 + platformio/builder/tools/platformio.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 15b0dab8b5..335b2ccf51 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -17,6 +17,7 @@ ("PLATFORM",), ("FRAMEWORK",), ("BUILD_FLAGS",), + ("SRCBUILD_FLAGS",), # board options ("BOARD",), diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index cc9ca226a1..3b0269cc21 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -43,6 +43,8 @@ def BuildFirmware(env, libslist): if _libs: libslist += _libs + src.MergeFlags(getenv("PIOSRCBUILD_FLAGS", "$SRCBUILD_FLAGS")) + return src.Program( join("$BUILD_DIR", "firmware"), [src.GlobCXXFiles(vdir) for vdir in vdirs], From 3c70babde47a3f9e8294a245ed1f74842cb11a9f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Jul 2014 22:35:40 +0300 Subject: [PATCH 09/25] Allowed to change default ".pioenvs" directory with global env "export $PIOENVS_DIR" --- platformio/builder/main.py | 6 ++++-- platformio/util.py | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 335b2ccf51..b9c05390fb 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -6,7 +6,8 @@ from SCons.Script import (DefaultEnvironment, Exit, SConscript, SConscriptChdir, Variables) -from platformio.util import get_home_dir, get_project_dir, get_source_dir +from platformio.util import (get_home_dir, get_pioenvs_dir, get_project_dir, + get_source_dir) # AllowSubstExceptions() @@ -37,13 +38,14 @@ PIOBUILDER_DIR=join(get_source_dir(), "builder"), PROJECT_DIR=get_project_dir(), + PIOENVS_DIR=get_pioenvs_dir(), PLATFORMIOHOME_DIR=get_home_dir(), PLATFORM_DIR=join("$PLATFORMIOHOME_DIR", "$PLATFORM"), PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"), PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"), - BUILD_DIR=join("$PROJECT_DIR", ".pioenvs", "$PIOENV"), + BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"), LIBSOURCE_DIRS=[ join("$PROJECT_DIR", "lib"), join("$PLATFORMFW_DIR", "libraries"), diff --git a/platformio/util.py b/platformio/util.py index a3ad8a1104..234085e746 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -1,16 +1,17 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -from os import getcwd, listdir, utime from os import name as os_name +from os import getcwd, getenv, listdir, utime from os.path import dirname, expanduser, isfile, join, realpath from platform import architecture, system from subprocess import PIPE, Popen from time import sleep -from platformio.exception import NotPlatformProject from serial import Serial +from platformio.exception import GetSerialPortsError, NotPlatformProject + try: from configparser import ConfigParser except ImportError: @@ -33,6 +34,10 @@ def get_project_dir(): return getcwd() +def get_pioenvs_dir(): + return getenv("PIOENVS_DIR", join(get_project_dir(), ".pioenvs")) + + def get_project_config(): path = join(get_project_dir(), "platformio.ini") if not isfile(path): From 202e2e0af56f13dbac72869584ea0b4402214967 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Jul 2014 22:39:41 +0300 Subject: [PATCH 10/25] Added support to override UPLOAD_PORT via cli-option "$ platformio run --upload-port=" --- platformio/__main__.py | 4 ++-- platformio/commands/init.py | 4 ++-- platformio/commands/run.py | 27 ++++++++++++++++++++------- platformio/exception.py | 10 ++++++++++ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/platformio/__main__.py b/platformio/__main__.py index 4312b42257..bf8f26d010 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -6,7 +6,7 @@ from sys import exit as sys_exit from traceback import format_exc -from click import command, MultiCommand, style, version_option +from click import command, MultiCommand, version_option from platformio import __version__ from platformio.exception import PlatformioException, UnknownCLICommand @@ -45,7 +45,7 @@ def main(): cli() except Exception as e: # pylint: disable=W0703 if isinstance(e, PlatformioException): - sys_exit(style("Error: ", fg="red") + str(e)) + sys_exit("Error: " + str(e)) else: print format_exc() diff --git a/platformio/commands/init.py b/platformio/commands/init.py index b1dd14bd3f..e839f81aa9 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -16,13 +16,13 @@ def cli(): if isfile("platformio.ini") and isdir("src"): raise ProjectInitialized() - for d in (".pioenvs", "lib", "src"): + for d in ("lib", "src"): if not isdir(d): makedirs(d) if not isfile("platformio.ini"): copyfile(join(get_source_dir(), "projectconftpl.ini"), "platformio.ini") - secho("Project successfully initialized.\n" + secho("Project has been successfully initialized!\n" "Please put your source code to `src` directory, " "external libraries to `lib` and " "setup environments in `platformio.ini` file.\n" diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 5f88253f29..820eea65e5 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -3,7 +3,8 @@ from click import command, echo, option, secho, style -from platformio.exception import ProjectEnvsNotAvaialable, UndefinedEnvPlatform +from platformio.exception import (InvalidEnvName, ProjectEnvsNotAvaialable, + UndefinedEnvPlatform, UnknownEnvNames) from platformio.platforms._base import PlatformFactory from platformio.util import get_project_config @@ -11,26 +12,38 @@ @command("run", short_help="Process project environments") @option("--environment", "-e", multiple=True, metavar="") @option("--target", "-t", multiple=True, metavar="") -def cli(environment, target): +@option("--upload-port", metavar="") +def cli(environment, target, upload_port): config = get_project_config() if not config.sections(): raise ProjectEnvsNotAvaialable() + envnames = [s[4:] for s in config.sections()] + unknown = set(environment) - set(envnames) + if unknown: + raise UnknownEnvNames(", ".join(unknown)) + for section in config.sections(): if section[:4] != "env:": - continue + raise InvalidEnvName(section) envname = section[4:] if environment and envname not in environment: - echo("Skipped %s environment" % style(envname, fg="yellow")) + # echo("Skipped %s environment" % style(envname, fg="yellow")) continue echo("Processing %s environment:" % style(envname, fg="cyan")) - variables = ["%s=%s" % (o.upper(), v) for o, v in config.items(section) - if o != "targets"] - variables.append("PIOENV=" + envname) + + variables = ["PIOENV=" + envname] + if upload_port: + variables.append("UPLOAD_PORT=%s" % upload_port) + for k, v in config.items(section): + k = k.upper() + if k == "TARGETS" or (k == "UPLOAD_PORT" and upload_port): + continue + variables.append("%s=%s" % (k.upper(), v)) envtargets = [] if target: diff --git a/platformio/exception.py b/platformio/exception.py index 9fe41d1ea9..7b7d08f182 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -87,6 +87,16 @@ class ProjectEnvsNotAvaialable(PlatformioException): MESSAGE = "Please setup environments in `platformio.ini` file." +class InvalidEnvName(PlatformioException): + + MESSAGE = "Invalid environment '%s'. The name must start " "with 'env:'." + + +class UnknownEnvNames(PlatformioException): + + MESSAGE = "Unknown environment names '%s'." + + class GetSerialPortsError(PlatformioException): MESSAGE = "No implementation for your platform ('%s') available" From bd47f44c1f20d426b375c935d1c9e84dcf64cbaa Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Jul 2014 22:42:04 +0300 Subject: [PATCH 11/25] Implemented especially for SmartAnthill "$ platformio run -t uploadlazy" target (no dependencies to framework libs, ELF and etc.) --- platformio/builder/scripts/atmelavr.py | 72 ++++++++++++-------------- platformio/builder/scripts/timsp430.py | 36 ++++--------- platformio/builder/scripts/titiva.py | 37 ++++--------- platformio/builder/tools/platformio.py | 21 ++++++++ 4 files changed, 74 insertions(+), 92 deletions(-) diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index 05b4f6b02e..96e785522e 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -8,8 +8,10 @@ from os.path import join from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, - DefaultEnvironment, Exit, SConscript, - SConscriptChdir) + DefaultEnvironment, Exit) + +from platformio.util import reset_serialport + env = DefaultEnvironment() @@ -66,9 +68,6 @@ UPLOADEEPCMD="$UPLOADER $UPLOADERFLAGS -U eeprom:w:$SOURCES:i" ) -if "BUILD_FLAGS" in env: - env.MergeFlags(env['BUILD_FLAGS']) - env.Append( BUILDERS=dict( ElfToEep=Builder( @@ -101,23 +100,7 @@ ) ) -env.PrependENVPath( - "PATH", - join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin") -) - -BUILT_LIBS = [] - -# -# Process framework script -# - -if "FRAMEWORK" in env: - SConscriptChdir(0) - flibs = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", - "frameworks", "${FRAMEWORK}.py")), - exports="env") - BUILT_LIBS += flibs +BUILT_LIBS = env.ProcessGeneral() # # Target: Build executable and linkable firmware @@ -129,39 +112,48 @@ # Target: Extract EEPROM data (from EEMEM directive) to .eep file # -target_eep = env.ElfToEep(join("$BUILD_DIR", "firmware"), target_elf) +target_eep = env.Alias("eep", env.ElfToEep(join("$BUILD_DIR", "firmware"), + target_elf)) # # Target: Build the .hex file # -target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_hex = join("$BUILD_DIR", "firmware.hex") +else: + target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) # -# Target: Upload .eep file +# Target: Upload by default .hex file # -eep = env.Alias("eep", target_eep, [ - lambda target, source, env: env.ResetDevice(), "$UPLOADEEPCMD"]) -AlwaysBuild(eep) +upload = env.Alias(["upload", "uploadlazy"], target_hex, [ + lambda target, source, env: reset_serialport(env.subst("$UPLOAD_PORT")), + "$UPLOADHEXCMD"]) +AlwaysBuild(upload) # -# Target: Upload .hex file +# Target: Upload .eep file # -upload = env.Alias("upload", target_hex, [ - lambda target, source, env: env.ResetDevice(), "$UPLOADHEXCMD"]) -AlwaysBuild(upload) +uploadeep = env.Alias("uploadeep", target_eep, [ + lambda target, source, env: reset_serialport(env.subst("$UPLOAD_PORT")), + "$UPLOADEEPCMD"]) +AlwaysBuild(uploadeep) # -# Target: Define targets +# Check for $UPLOAD_PORT variable # -env.Alias("build-eep", [target_eep]) -Default([target_elf, target_hex]) - -# check for $UPLOAD_PORT variable -is_uptarget = ("eep" in COMMAND_LINE_TARGETS or "upload" in - COMMAND_LINE_TARGETS) +is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) & + set(COMMAND_LINE_TARGETS)) if is_uptarget and not env.subst("$UPLOAD_PORT"): - Exit("Please specify 'upload_port'") + Exit("Please specify environment 'upload_port' or use global " + "--upload-port option.") + +# +# Setup default targets +# + +Default(target_hex) diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py index 4578de998a..dbf1322d83 100644 --- a/platformio/builder/scripts/timsp430.py +++ b/platformio/builder/scripts/timsp430.py @@ -8,11 +8,12 @@ from os.path import join -from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment, - SConscript, SConscriptChdir) +from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, + DefaultEnvironment) from platformio.util import get_system + env = DefaultEnvironment() env.Replace( @@ -60,9 +61,6 @@ UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"' ) -if "BUILD_FLAGS" in env: - env.MergeFlags(env['BUILD_FLAGS']) - env.Append( BUILDERS=dict( ElfToHex=Builder( @@ -79,24 +77,7 @@ ) ) -env.PrependENVPath( - "PATH", - join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin") -) - -BUILT_LIBS = [] - -# -# Process framework script -# - -if "FRAMEWORK" in env: - SConscriptChdir(0) - flibs = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", - "frameworks", "${FRAMEWORK}.py")), - exports="env") - BUILT_LIBS += flibs - +BUILT_LIBS = env.ProcessGeneral() # # Target: Build executable and linkable firmware @@ -108,17 +89,20 @@ # Target: Build the .hex # -target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_hex = join("$BUILD_DIR", "firmware.hex") +else: + target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) # # Target: Upload firmware # -upload = env.Alias("upload", target_hex, ["$UPLOADCMD"]) +upload = env.Alias(["upload", "uploadlazy"], target_hex, "$UPLOADCMD") AlwaysBuild(upload) # # Target: Define targets # -Default([target_elf, target_hex]) +Default(target_hex) diff --git a/platformio/builder/scripts/titiva.py b/platformio/builder/scripts/titiva.py index c5ad725fb8..ab2ad8b853 100644 --- a/platformio/builder/scripts/titiva.py +++ b/platformio/builder/scripts/titiva.py @@ -8,8 +8,9 @@ from os.path import join -from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment, - SConscript, SConscriptChdir) +from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, + DefaultEnvironment) + env = DefaultEnvironment() @@ -75,9 +76,6 @@ UPLOADCMD="$UPLOADER $SOURCES" ) -if "BUILD_FLAGS" in env: - env.MergeFlags(env['BUILD_FLAGS']) - env.Append( BUILDERS=dict( ElfToBin=Builder( @@ -87,28 +85,12 @@ "binary", "$SOURCES", "$TARGET"]), - suffix=".hex" + suffix=".bin" ) ) ) -env.PrependENVPath( - "PATH", - join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin") -) - -BUILT_LIBS = [] - -# -# Process framework script -# - -if "FRAMEWORK" in env: - SConscriptChdir(0) - flibs = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", - "frameworks", "${FRAMEWORK}.py")), - exports="env") - BUILT_LIBS += flibs +BUILT_LIBS = env.ProcessGeneral() # # Target: Build executable and linkable firmware @@ -120,17 +102,20 @@ # Target: Build the .bin file # -target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_bin = join("$BUILD_DIR", "firmware.bin") +else: + target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) # # Target: Upload firmware # -upload = env.Alias("upload", target_bin, ["$UPLOADCMD"]) +upload = env.Alias(["upload", "uploadlazy"], target_bin, "$UPLOADCMD") AlwaysBuild(upload) # # Target: Define targets # -Default([target_elf, target_bin]) +Default(target_bin) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 3b0269cc21..9216c6061b 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -2,8 +2,28 @@ # See LICENSE for details. import re +from os import getenv, listdir, walk from os.path import isdir, isfile, join +from SCons.Script import SConscript, SConscriptChdir + + +def ProcessGeneral(env): + libs = [] + if "BUILD_FLAGS" in env: + env.MergeFlags(env['BUILD_FLAGS']) + + env.PrependENVPath( + "PATH", + join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin") + ) + + if "FRAMEWORK" in env: + SConscriptChdir(0) + libs = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", + "frameworks", "${FRAMEWORK}.py")), + exports="env") + return libs def BuildLibrary(env, variant_dir, library_dir): @@ -120,6 +140,7 @@ def exists(_): def generate(env): + env.AddMethod(ProcessGeneral) env.AddMethod(BuildLibrary) env.AddMethod(BuildDependentLibraries) env.AddMethod(BuildFirmware) From 02fe590dc46badf09f6c0f15b8be3f2c8a2d5205 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Jul 2014 22:48:27 +0300 Subject: [PATCH 12/25] PyLint fix for CI --- platformio/commands/run.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 820eea65e5..104eaf6b61 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -20,8 +20,7 @@ def cli(environment, target, upload_port): if not config.sections(): raise ProjectEnvsNotAvaialable() - envnames = [s[4:] for s in config.sections()] - unknown = set(environment) - set(envnames) + unknown = set(environment) - set([s[4:] for s in config.sections()]) if unknown: raise UnknownEnvNames(", ".join(unknown)) From ec39cfeb9085ca989ba1d30d5989f11db48cc990 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Jul 2014 21:18:26 +0300 Subject: [PATCH 13/25] Filled README & HISTORY with latest additions --- HISTORY.rst | 14 ++ README.rst | 221 ++++++++++++++++++------------- platformio/commands/init.py | 4 +- platformio/commands/uninstall.py | 2 +- platformio/projectconftpl.ini | 3 +- requirements.txt | 2 +- 6 files changed, 146 insertions(+), 100 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index eeba00ab5e..4114d0f12e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,20 @@ Release History 1.0.0 (?) --------- +0.4.0 (?) +--------- + +* Implemented ``serialports`` command +* Allowed to put special build flags only for ``src`` files via + ``srcbuild_flags`` environment option +* Allowed to override some of settings via system environment variables + such as: ``$PIOSRCBUILD_FLAGS`` and ``$PIOENVS_DIR`` +* Added ``--upload-port`` option for ``platformio run`` command +* Implemented (especially for `SmartAnthill `_) + ``platformio run -t uploadlazy`` target (no dependencies to framework libs, + ELF and etc.) + + 0.3.1 (2014-06-21) ------------------ diff --git a/README.rst b/README.rst index 83a7484168..68e7399cc0 100644 --- a/README.rst +++ b/README.rst @@ -256,36 +256,42 @@ To print all available commands and options: --help Show this message and exit. Commands: - init Initialize new platformio based project - install Install new platforms - list List installed platforms - run Process project environments - search Search for development platforms - show Show details about an installed platforms - uninstall Uninstall the platforms - update Update installed platforms + init Initialize new PlatformIO based project + install Install new platforms + list List installed platforms + run Process project environments + search Search for development platforms + serialports List Serial ports + show Show details about an installed platforms + uninstall Uninstall platforms + update Update installed platforms -``platformio search`` -~~~~~~~~~~~~~~~~~~~~~ +``platformio init`` +~~~~~~~~~~~~~~~~~~~ -Search for development platforms: +Initialize new PlatformIO based project. .. code-block:: bash - # Print all available development platforms - $ platformio search all - - # Filter platforms by "Query" - $ platformio search "Query" + # Change directory to future project + $ cd /path/to/empty/directory + $ platformio init # Example - $ platformio search ti - timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework) - titiva - An embedded platform for TI TIVA C ARM microcontrollers (with Energia Framework) + $ platformio init + Project has been initialized! + Please put your source code to `src` directory, external libraries to `lib` + and setup environments in `platformio.ini` file. + Then process project with `platformio run` command. - $ platformio search arduino - atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework) +After this command ``platformio`` will create: + +* ``.pioenvs`` - a temporary working directory. +* ``lib`` - a directory for project specific libraries. PlatformIO will + compile their to static libraries and link to executable file +* ``src`` - a source directory. Put code here. +* ``platformio.ini`` - a configuration file for project ``platformio install`` @@ -328,76 +334,6 @@ To list installed platforms: timsp430 with packages: toolchain-timsp430, tool-mspdebug, framework-energiamsp430 -``platformio show`` -~~~~~~~~~~~~~~~~~~~ - -To show details about an installed platform: - -.. code-block:: bash - - $ platformio show SomePlatform - - # Example - $ platformio show timsp430 - timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework) - ---------- - Package: toolchain-timsp430 - Location: /Users/ikravets/.platformio/timsp430/tools/toolchain - Version: 1 - ---------- - Package: tool-mspdebug - Location: /Users/ikravets/.platformio/timsp430/tools/mspdebug - Version: 1 - ---------- - Package: framework-energiamsp430 - Location: /Users/ikravets/.platformio/timsp430/frameworks/energia - Version: 1 - - -``platformio uninstall`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -To uninstall platform: - -.. code-block:: bash - - $ platformio uninstall SomePlatform - - # Example - $ platformio uninstall timsp430 - Uninstalling toolchain-timsp430 package: [OK] - Uninstalling tool-mspdebug package: [OK] - Uninstalling framework-energiamsp430 package: [OK] - The platform 'timsp430' has been successfully uninstalled! - - -``platformio init`` -~~~~~~~~~~~~~~~~~~~ - -Initialize new platformio based project. - -.. code-block:: bash - - # Change directory to future project - $ cd /path/to/empty/directory - $ platformio init - - # Example - $ platformio init - Project successfully initialized. - Please put your source code to `src` directory, external libraries to `lib` - and setup environments in `platformio.ini` file. - Then process project with `platformio run` command. - -After this command ``platformio`` will create: - -* ``.pioenvs`` - a temporary working directory. -* ``lib`` - a directory for project specific libraries. PlatformIO will - compile their to static libraries and link to executable file -* ``src`` - a source directory. Put code here. -* ``platformio.ini`` - a configuration file for project - - ``platformio run`` ~~~~~~~~~~~~~~~~~~ @@ -433,7 +369,6 @@ Process specific environments: scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date. scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date. - Skipped launchpad_msp430g2 environment Processing launchpad_lm4f120 environment: scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date. scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date. @@ -443,7 +378,7 @@ Process specific target: .. code-block:: bash $ platformio run -t clean - $ platformio run -t upload + $ platformio run -t upload --upload-port=/dev/ttyUSBX # Example platformio run -t clean @@ -470,7 +405,6 @@ Mix environments and targets: # Example $ platformio run -e launchpad_msp430g2 -t upload - Skipped arduino_pro5v environment Processing launchpad_msp430g2 environment: /Users/ikravets/.platformio/timsp430/tools/mspdebug/mspdebug rf2500 --force-reset "prog .pioenvs/launchpad_msp430g2/firmware.hex" MSPDebug version 0.20 - debugging tool for MSP430 MCUs @@ -500,7 +434,104 @@ Mix environments and targets: Writing 32 bytes at ffe0... Done, 678 bytes total - Skipped launchpad_lm4f120 environment + +``platformio search`` +~~~~~~~~~~~~~~~~~~~~~ + +Search for development platforms: + +.. code-block:: bash + + # Print all available development platforms + $ platformio search all + + # Filter platforms by "Query" + $ platformio search "Query" + + # Example + $ platformio search ti + timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework) + titiva - An embedded platform for TI TIVA C ARM microcontrollers (with Energia Framework) + + $ platformio search arduino + atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework) + + +``platformio serialports`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To list available `Serial Ports `_: + +.. code-block:: bash + + $ platformio serialports + + # Example (Posix) + $ platformio serialports + /dev/cu.SLAB_USBtoUART + ---------- + Hardware ID: USB VID:PID=10c4:ea60 SNR=0001 + Description: CP2102 USB to UART Bridge Controller + + /dev/cu.uart-1CFF4676258F4543 + ---------- + Hardware ID: USB VID:PID=451:f432 SNR=1CFF4676258F4543 + Description: Texas Instruments MSP-FET430UIF + + # Example (Windows) + $ platformio serialports + COM4 + ---------- + Hardware ID: USB VID:PID=0451:F432 + Description: MSP430 Application UART (COM4) + + COM3 + ---------- + Hardware ID: USB VID:PID=10C4:EA60 SNR=0001 + Description: Silicon Labs CP210x USB to UART Bridge (COM3) + + +``platformio show`` +~~~~~~~~~~~~~~~~~~~ + +To show details about an installed platform: + +.. code-block:: bash + + $ platformio show SomePlatform + + # Example + $ platformio show timsp430 + timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework) + ---------- + Package: toolchain-timsp430 + Location: /Users/ikravets/.platformio/timsp430/tools/toolchain + Version: 1 + ---------- + Package: tool-mspdebug + Location: /Users/ikravets/.platformio/timsp430/tools/mspdebug + Version: 1 + ---------- + Package: framework-energiamsp430 + Location: /Users/ikravets/.platformio/timsp430/frameworks/energia + Version: 1 + + +``platformio uninstall`` +~~~~~~~~~~~~~~~~~~~~~~~~ + +To uninstall platform: + +.. code-block:: bash + + $ platformio uninstall SomePlatform + + # Example + $ platformio uninstall timsp430 + Uninstalling toolchain-timsp430 package: [OK] + Uninstalling tool-mspdebug package: [OK] + Uninstalling framework-energiamsp430 package: [OK] + The platform 'timsp430' has been successfully uninstalled! ``platformio update`` diff --git a/platformio/commands/init.py b/platformio/commands/init.py index e839f81aa9..418783b2ca 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -11,7 +11,7 @@ from platformio.util import get_source_dir -@command("init", short_help="Initialize new platformio based project") +@command("init", short_help="Initialize new PlatformIO based project") def cli(): if isfile("platformio.ini") and isdir("src"): @@ -22,7 +22,7 @@ def cli(): if not isfile("platformio.ini"): copyfile(join(get_source_dir(), "projectconftpl.ini"), "platformio.ini") - secho("Project has been successfully initialized!\n" + secho("Project has been initialized!\n" "Please put your source code to `src` directory, " "external libraries to `lib` and " "setup environments in `platformio.ini` file.\n" diff --git a/platformio/commands/uninstall.py b/platformio/commands/uninstall.py index 92c5b0cf6a..b7ecb0c42c 100644 --- a/platformio/commands/uninstall.py +++ b/platformio/commands/uninstall.py @@ -8,7 +8,7 @@ from platformio.platforms._base import PlatformFactory -@command("uninstall", short_help="Uninstall the platforms") +@command("uninstall", short_help="Uninstall platforms") @argument("platforms", nargs=-1) def cli(platforms): diff --git a/platformio/projectconftpl.ini b/platformio/projectconftpl.ini index 18348f52d9..06d414ba57 100644 --- a/platformio/projectconftpl.ini +++ b/platformio/projectconftpl.ini @@ -14,7 +14,8 @@ # Environment with specific build flags #[env:specbuildflags] #platform = %INSTALLED_PLATFORM_NAME_HERE% -#build_flags = "-I/opt/include -L/opt/lib -lfoo -DMYDEFINE=13" +#build_flags = "-I/opt/include -L/opt/lib -lfoo" +#srcbuild_flags = "-DSPECIAL_DEFINE_FOR_MY_SRC_FILES=13" # # Atmel AVR based board diff --git a/requirements.txt b/requirements.txt index 7e3416da32..ffd41083bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -click==2.4 +click==2.5 colorama==0.3.1 pyserial==2.7 requests==2.3.0 From e1b205c95aab0ae95f5e4a09b64638f738ded8de Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Jul 2014 21:28:20 +0300 Subject: [PATCH 14/25] Added simple menu with navigation by README --- README.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 68e7399cc0..c4bdff9963 100644 --- a/README.rst +++ b/README.rst @@ -17,6 +17,10 @@ PlatformIO :target: https://pypi.python.org/pypi/platformio/ :alt: License +**`Quickstart <#quickstart>`_ | `Installation <#installation`_ | +`Documentation <#documentation>`_ | `Embedded Platform Boards <#embedded-platform-boards>`_ | +`IDE Integration <#ide-integration>`_** + **PlatformIO** is a console tool to build code with different development platforms. @@ -237,8 +241,8 @@ For upgrading the ``platformio`` to new version please use this command: $ pip install -U platformio -User Guide ----------- +Documentation +------------- To print all available commands and options: From 3a6a48aa22e5d9af80e221e3fb950797cc2c6785 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Jul 2014 21:28:59 +0300 Subject: [PATCH 15/25] Corrected README menu --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index c4bdff9963..8ee350f651 100644 --- a/README.rst +++ b/README.rst @@ -17,9 +17,9 @@ PlatformIO :target: https://pypi.python.org/pypi/platformio/ :alt: License -**`Quickstart <#quickstart>`_ | `Installation <#installation`_ | +** `Quickstart <#quickstart>`_ | `Installation <#installation`_ | `Documentation <#documentation>`_ | `Embedded Platform Boards <#embedded-platform-boards>`_ | -`IDE Integration <#ide-integration>`_** +`IDE Integration <#ide-integration>`_ ** **PlatformIO** is a console tool to build code with different development From 529a4c2d34989ac07c6084d7e41f25454a4d8ded Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Jul 2014 21:29:55 +0300 Subject: [PATCH 16/25] Fixed GitHub issue with RST bold --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 8ee350f651..cfdc8b92ba 100644 --- a/README.rst +++ b/README.rst @@ -17,9 +17,9 @@ PlatformIO :target: https://pypi.python.org/pypi/platformio/ :alt: License -** `Quickstart <#quickstart>`_ | `Installation <#installation`_ | +`Quickstart <#quickstart>`_ | `Installation <#installation`_ | `Documentation <#documentation>`_ | `Embedded Platform Boards <#embedded-platform-boards>`_ | -`IDE Integration <#ide-integration>`_ ** +`IDE Integration <#ide-integration>`_ **PlatformIO** is a console tool to build code with different development From 14c2e606e5d8f65132ad15954594e475751f1324 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Jul 2014 21:32:55 +0300 Subject: [PATCH 17/25] Added "Examples" to README menu --- README.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index cfdc8b92ba..31aabe1e1c 100644 --- a/README.rst +++ b/README.rst @@ -17,8 +17,11 @@ PlatformIO :target: https://pypi.python.org/pypi/platformio/ :alt: License -`Quickstart <#quickstart>`_ | `Installation <#installation`_ | -`Documentation <#documentation>`_ | `Embedded Platform Boards <#embedded-platform-boards>`_ | +`Quickstart <#quickstart>`_ | +`Installation <#installation>`_ | +`Documentation <#documentation>`_ | +`Examples `_ | +`Embedded Platform Boards <#embedded-platform-boards>`_ | `IDE Integration <#ide-integration>`_ From 02d7aa1e1ee598a6d1b473916839c79e4a4832b5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Jul 2014 21:35:01 +0300 Subject: [PATCH 18/25] Added "Blog" to README menu --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 31aabe1e1c..af542c26fa 100644 --- a/README.rst +++ b/README.rst @@ -22,7 +22,8 @@ PlatformIO `Documentation <#documentation>`_ | `Examples `_ | `Embedded Platform Boards <#embedded-platform-boards>`_ | -`IDE Integration <#ide-integration>`_ +`IDE Integration <#ide-integration>`_ | +`Blog `_ **PlatformIO** is a console tool to build code with different development From dac83d6164a0e04b301cf703ea312d896fca32e4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 Jul 2014 22:40:11 +0300 Subject: [PATCH 19/25] Refactored "base" paltform --- platformio/commands/install.py | 2 +- platformio/commands/list.py | 2 +- platformio/commands/run.py | 2 +- platformio/commands/search.py | 2 +- platformio/commands/show.py | 4 +- platformio/commands/uninstall.py | 2 +- platformio/commands/update.py | 2 +- platformio/platforms/atmelavr.py | 2 +- platformio/platforms/{_base.py => base.py} | 47 +++++++++++++++++----- platformio/platforms/timsp430.py | 2 +- platformio/platforms/titiva.py | 2 +- 11 files changed, 47 insertions(+), 22 deletions(-) rename platformio/platforms/{_base.py => base.py} (61%) diff --git a/platformio/commands/install.py b/platformio/commands/install.py index 09f75500e3..56cb6e3f81 100644 --- a/platformio/commands/install.py +++ b/platformio/commands/install.py @@ -3,7 +3,7 @@ from click import argument, command, option, secho -from platformio.platforms._base import PlatformFactory +from platformio.platforms.base import PlatformFactory @command("install", short_help="Install new platforms") diff --git a/platformio/commands/list.py b/platformio/commands/list.py index 699d2fb08d..990429bfdf 100644 --- a/platformio/commands/list.py +++ b/platformio/commands/list.py @@ -9,7 +9,7 @@ @command("list", short_help="List installed platforms") def cli(): - for name, pkgs in PackageManager.get_installed().iteritems(): + for name, pkgs in PackageManager.get_installed().items(): echo("{name:<20} with packages: {pkgs}".format( name=style(name, fg="cyan"), pkgs=", ".join(pkgs.keys()) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 104eaf6b61..4422c1d054 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -5,7 +5,7 @@ from platformio.exception import (InvalidEnvName, ProjectEnvsNotAvaialable, UndefinedEnvPlatform, UnknownEnvNames) -from platformio.platforms._base import PlatformFactory +from platformio.platforms.base import PlatformFactory from platformio.util import get_project_config diff --git a/platformio/commands/search.py b/platformio/commands/search.py index 9990b4884e..2457b05e3c 100644 --- a/platformio/commands/search.py +++ b/platformio/commands/search.py @@ -3,7 +3,7 @@ from click import argument, command, echo, style -from platformio.platforms._base import PlatformFactory +from platformio.platforms.base import PlatformFactory from platformio.util import get_platforms diff --git a/platformio/commands/show.py b/platformio/commands/show.py index 9ae904c9c3..da4c552ff7 100644 --- a/platformio/commands/show.py +++ b/platformio/commands/show.py @@ -7,7 +7,7 @@ from platformio.exception import PlatformNotInstalledYet from platformio.pkgmanager import PackageManager -from platformio.platforms._base import PlatformFactory +from platformio.platforms.base import PlatformFactory @command("show", short_help="Show details about an installed platforms") @@ -22,7 +22,7 @@ def cli(platform): info=p.get_short_info())) pm = PackageManager(platform) - for name, data in pm.get_installed(platform).iteritems(): + for name, data in pm.get_installed(platform).items(): echo("----------") echo("Package: %s" % style(name, fg="yellow")) echo("Location: %s" % join(pm.get_platform_dir(), data['path'])) diff --git a/platformio/commands/uninstall.py b/platformio/commands/uninstall.py index b7ecb0c42c..7276591130 100644 --- a/platformio/commands/uninstall.py +++ b/platformio/commands/uninstall.py @@ -5,7 +5,7 @@ from platformio.exception import PlatformNotInstalledYet from platformio.pkgmanager import PackageManager -from platformio.platforms._base import PlatformFactory +from platformio.platforms.base import PlatformFactory @command("uninstall", short_help="Uninstall platforms") diff --git a/platformio/commands/update.py b/platformio/commands/update.py index 6bd2432d34..8fad8523ab 100644 --- a/platformio/commands/update.py +++ b/platformio/commands/update.py @@ -4,7 +4,7 @@ from click import command, echo, style from platformio.pkgmanager import PackageManager -from platformio.platforms._base import PlatformFactory +from platformio.platforms.base import PlatformFactory @command("update", short_help="Update installed platforms") diff --git a/platformio/platforms/atmelavr.py b/platformio/platforms/atmelavr.py index 676cb010d6..2e2971f644 100644 --- a/platformio/platforms/atmelavr.py +++ b/platformio/platforms/atmelavr.py @@ -3,7 +3,7 @@ from os.path import join -from platformio.platforms._base import BasePlatform +from platformio.platforms.base import BasePlatform class AtmelavrPlatform(BasePlatform): diff --git a/platformio/platforms/_base.py b/platformio/platforms/base.py similarity index 61% rename from platformio/platforms/_base.py rename to platformio/platforms/base.py index fc92a733e7..afda73ed9c 100644 --- a/platformio/platforms/_base.py +++ b/platformio/platforms/base.py @@ -40,30 +40,55 @@ def get_short_info(self): else: raise NotImplementedError() - def install(self, with_packages, without_packages): - requirements = [] - pm = PackageManager(self.get_name()) + def get_pkgname_by_alias(self, alias): + for name, opts in self.PACKAGES.items(): + if opts.get("alias", None) == alias: + return name + return None + + def install(self, with_packages, without_packages, skip_default_packages): + with_packages = set(with_packages) + without_packages = set(without_packages) - upkgs = set(with_packages + without_packages) + upkgs = with_packages | without_packages ppkgs = set(self.PACKAGES.keys()) - if not upkgs.issubset(ppkgs): - raise UnknownPackage(", ".join(upkgs - ppkgs)) + unknown = upkgs - ppkgs + if unknown: + _unknown = unknown.copy() + # maybe aliases + for alias in unknown: + pkgname = self.get_pkgname_by_alias(alias) + if pkgname not in self.PACKAGES: + continue + if alias in with_packages: + with_packages.discard(alias) + with_packages.add(pkgname) + if alias in without_packages: + without_packages.discard(alias) + without_packages.add(pkgname) + _unknown.discard(alias) + + if _unknown: + raise UnknownPackage(", ".join(_unknown)) - for name, opts in self.PACKAGES.iteritems(): + requirements = [] + for name, opts in self.PACKAGES.items(): if name in without_packages: continue - elif name in with_packages or opts["default"]: - requirements.append((name, opts["path"])) + elif (name in with_packages or (not skip_default_packages and + opts['default'])): + requirements.append((name, opts['path'])) + pm = PackageManager(self.get_name()) for (package, path) in requirements: pm.install(package, path) - return True + return len(requirements) def uninstall(self): platform = self.get_name() pm = PackageManager(platform) - for package, data in pm.get_installed(platform).iteritems(): + for package, data in pm.get_installed(platform).items(): pm.uninstall(package, data['path']) pm.unregister_platform(platform) diff --git a/platformio/platforms/timsp430.py b/platformio/platforms/timsp430.py index 34a859b506..03966eaee8 100644 --- a/platformio/platforms/timsp430.py +++ b/platformio/platforms/timsp430.py @@ -3,7 +3,7 @@ from os.path import join -from platformio.platforms._base import BasePlatform +from platformio.platforms.base import BasePlatform class Timsp430Platform(BasePlatform): diff --git a/platformio/platforms/titiva.py b/platformio/platforms/titiva.py index ecdba1251b..cee2709b96 100644 --- a/platformio/platforms/titiva.py +++ b/platformio/platforms/titiva.py @@ -3,7 +3,7 @@ from os.path import join -from platformio.platforms._base import BasePlatform +from platformio.platforms.base import BasePlatform class TitivaPlatform(BasePlatform): From 3125c8485b0d8a97c52cf12e83cd8e4a5b3be267 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 Jul 2014 22:41:07 +0300 Subject: [PATCH 20/25] Allowed to skip default packages via --skip-default-package flag --- HISTORY.rst | 1 + README.rst | 18 +++++++++++++----- platformio/commands/install.py | 11 +++++------ platformio/platforms/atmelavr.py | 4 +++- platformio/platforms/timsp430.py | 4 +++- platformio/platforms/titiva.py | 4 +++- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 4114d0f12e..71c68c4035 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,7 @@ Release History * Implemented (especially for `SmartAnthill `_) ``platformio run -t uploadlazy`` target (no dependencies to framework libs, ELF and etc.) +* Allowed to skip default packages via ``platformio install--skip-default-package`` flag 0.3.1 (2014-06-21) diff --git a/README.rst b/README.rst index af542c26fa..de8bebe751 100644 --- a/README.rst +++ b/README.rst @@ -93,7 +93,7 @@ Platform ``atmelavr`` * ``diecimilaatmega168`` Arduino Duemilanove or Diecimila (ATmega168) * ``diecimilaatmega328`` Arduino Duemilanove or Diecimila (ATmega328) * ``fio`` Arduino Fio -* ``leonardo`` Arduino Leonard +* ``leonardo`` Arduino Leonardo * ``LilyPadUSB`` Arduino LilyPad USB * ``lilypadatmega168`` Arduino LilyPad (ATmega168) * ``lilypadatmega328`` Arduino LilyPad (ATmega328) @@ -158,7 +158,7 @@ Quickstart $ platformio run For more detailed information please follow to `Installation <#installation>`_ -and `User Guide <#user-guide>`_ sections. +and `Documentation <#documentation>`_ sections. Installation @@ -311,11 +311,12 @@ can install one of them: .. code-block:: bash $ platformio install SomePlatform - $ platformio install SomePlatform --with-package=PackageName - $ platformio install SomePlatform --without-package=PackageName + $ platformio install SomePlatform --with-package=toolchain|uploader|PackageName + $ platformio install SomePlatform --without-package=toolchain|uploader|PackageName + $ platformio install SomePlatform --skip-default-package # Example - $ platformio install timsp430 --with-package=framework-energiamsp430 + $ platformio install timsp430 Installing toolchain-timsp430 package: Downloading [####################################] 100% Unpacking [####################################] 100% @@ -327,6 +328,13 @@ can install one of them: Unpacking [####################################] 100% The platform 'timsp430' has been successfully installed! + # Skip default packages and install uploader utility only + $ platformio install timsp430 --skip-default-package --with-package=uploader + Installing tool-mspdebug package: + Downloading [####################################] 100% + Unpacking [####################################] 100% + The platform 'timsp430' has been successfully installed! + ``platformio list`` ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/commands/install.py b/platformio/commands/install.py index 56cb6e3f81..834ce14c95 100644 --- a/platformio/commands/install.py +++ b/platformio/commands/install.py @@ -8,14 +8,13 @@ @command("install", short_help="Install new platforms") @argument("platforms", nargs=-1) -@option('--with-package', multiple=True, metavar="") -@option('--without-package', multiple=True, metavar="") -def cli(platforms, with_package, without_package): +@option("--with-package", multiple=True, metavar="") +@option("--without-package", multiple=True, metavar="") +@option("--skip-default-package", is_flag=True) +def cli(platforms, with_package, without_package, skip_default_package): for platform in platforms: - p = PlatformFactory().newPlatform(platform) - - if p.install(with_package, without_package): + if p.install(with_package, without_package, skip_default_package): secho("The platform '%s' has been successfully installed!" % platform, fg="green") diff --git a/platformio/platforms/atmelavr.py b/platformio/platforms/atmelavr.py index 2e2971f644..4ba6e1173e 100644 --- a/platformio/platforms/atmelavr.py +++ b/platformio/platforms/atmelavr.py @@ -16,12 +16,14 @@ class AtmelavrPlatform(BasePlatform): "toolchain-atmelavr": { "path": join("tools", "toolchain"), + "alias": "toolchain", "default": True }, "tool-avrdude": { "path": join("tools", "avrdude"), - "default": True, + "alias": "uploader", + "default": True }, "framework-arduinoavr": { diff --git a/platformio/platforms/timsp430.py b/platformio/platforms/timsp430.py index 03966eaee8..7058af1691 100644 --- a/platformio/platforms/timsp430.py +++ b/platformio/platforms/timsp430.py @@ -16,12 +16,14 @@ class Timsp430Platform(BasePlatform): "toolchain-timsp430": { "path": join("tools", "toolchain"), + "alias": "toolchain", "default": True }, "tool-mspdebug": { "path": join("tools", "mspdebug"), - "default": True, + "alias": "uploader", + "default": True }, "framework-energiamsp430": { diff --git a/platformio/platforms/titiva.py b/platformio/platforms/titiva.py index cee2709b96..ed89cb4465 100644 --- a/platformio/platforms/titiva.py +++ b/platformio/platforms/titiva.py @@ -16,12 +16,14 @@ class TitivaPlatform(BasePlatform): "toolchain-gccarmnoneeabi": { "path": join("tools", "toolchain"), + "alias": "toolchain", "default": True }, "tool-lm4flash": { "path": join("tools", "lm4flash"), - "default": True, + "alias": "uploader", + "default": True }, "framework-energiativa": { From ffa3d3f2f1ef646d44160b8dfaa1448b025e5d1e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 Jul 2014 23:08:36 +0300 Subject: [PATCH 21/25] Optimised conversion from package aliases to names --- HISTORY.rst | 2 +- platformio/platforms/base.py | 41 ++++++++++++++---------------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 71c68c4035..f72038f06a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,7 +16,7 @@ Release History * Implemented (especially for `SmartAnthill `_) ``platformio run -t uploadlazy`` target (no dependencies to framework libs, ELF and etc.) -* Allowed to skip default packages via ``platformio install--skip-default-package`` flag +* Allowed to skip default packages via ``platformio install --skip-default-package`` flag 0.3.1 (2014-06-21) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index afda73ed9c..8b6233fc71 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -40,36 +40,27 @@ def get_short_info(self): else: raise NotImplementedError() - def get_pkgname_by_alias(self, alias): - for name, opts in self.PACKAGES.items(): - if opts.get("alias", None) == alias: - return name - return None + def pkg_aliases_to_names(self, aliases): + names = [] + for alias in aliases: + name = alias + # lookup by packages alias + if name not in self.PACKAGES: + for _name, _opts in self.PACKAGES.items(): + if _opts.get("alias", None) == alias: + name = _name + break + names.append(name) + return names def install(self, with_packages, without_packages, skip_default_packages): - with_packages = set(with_packages) - without_packages = set(without_packages) + with_packages = set(self.pkg_aliases_to_names(with_packages)) + without_packages = set(self.pkg_aliases_to_names(without_packages)) upkgs = with_packages | without_packages ppkgs = set(self.PACKAGES.keys()) - unknown = upkgs - ppkgs - if unknown: - _unknown = unknown.copy() - # maybe aliases - for alias in unknown: - pkgname = self.get_pkgname_by_alias(alias) - if pkgname not in self.PACKAGES: - continue - if alias in with_packages: - with_packages.discard(alias) - with_packages.add(pkgname) - if alias in without_packages: - without_packages.discard(alias) - without_packages.add(pkgname) - _unknown.discard(alias) - - if _unknown: - raise UnknownPackage(", ".join(_unknown)) + if not upkgs.issubset(ppkgs): + raise UnknownPackage(", ".join(upkgs - ppkgs)) requirements = [] for name, opts in self.PACKAGES.items(): From c4d2dc62676afce392206bca877a17d0ded4790d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 Jul 2014 23:39:01 +0300 Subject: [PATCH 22/25] Show "Alias" for packages in "platformio show" command --- README.rst | 18 ++++++++++-------- platformio/commands/show.py | 3 +++ platformio/platforms/base.py | 3 +++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index de8bebe751..fef447ceea 100644 --- a/README.rst +++ b/README.rst @@ -517,19 +517,21 @@ To show details about an installed platform: $ platformio show SomePlatform # Example - $ platformio show timsp430 - timsp430 - An embedded platform for TI MSP430 microcontrollers (with Energia Framework) + $ platformio show atmelavr + atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework) ---------- - Package: toolchain-timsp430 - Location: /Users/ikravets/.platformio/timsp430/tools/toolchain + Package: toolchain-atmelavr + Alias: toolchain + Location: /Users/ikravets/.platformio/atmelavr/tools/toolchain Version: 1 ---------- - Package: tool-mspdebug - Location: /Users/ikravets/.platformio/timsp430/tools/mspdebug + Package: tool-avrdude + Alias: uploader + Location: /Users/ikravets/.platformio/atmelavr/tools/avrdude Version: 1 ---------- - Package: framework-energiamsp430 - Location: /Users/ikravets/.platformio/timsp430/frameworks/energia + Package: framework-arduinoavr + Location: /Users/ikravets/.platformio/atmelavr/frameworks/arduino Version: 1 diff --git a/platformio/commands/show.py b/platformio/commands/show.py index da4c552ff7..616a7a519e 100644 --- a/platformio/commands/show.py +++ b/platformio/commands/show.py @@ -23,7 +23,10 @@ def cli(platform): pm = PackageManager(platform) for name, data in pm.get_installed(platform).items(): + pkgalias = p.get_pkg_alias(name) echo("----------") echo("Package: %s" % style(name, fg="yellow")) + if pkgalias: + echo("Alias: %s" % pkgalias) echo("Location: %s" % join(pm.get_platform_dir(), data['path'])) echo("Version: %d" % int(data['version'])) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 8b6233fc71..cbca3fea0e 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -40,6 +40,9 @@ def get_short_info(self): else: raise NotImplementedError() + def get_pkg_alias(self, pkgname): + return self.PACKAGES[pkgname].get("alias", None) + def pkg_aliases_to_names(self, aliases): names = [] for alias in aliases: From e81723f73c5c00c4cf38412d131a81f2ba8fdace Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 31 Jul 2014 16:18:17 +0300 Subject: [PATCH 23/25] Added support for Raspberry Pi, Microduino and Raspduino --- HISTORY.rst | 6 ++++-- README.rst | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f72038f06a..3746622a37 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,8 +4,8 @@ Release History 1.0.0 (?) --------- -0.4.0 (?) ---------- +0.4.0 (2014-07-31) +------------------ * Implemented ``serialports`` command * Allowed to put special build flags only for ``src`` files via @@ -17,6 +17,8 @@ Release History ``platformio run -t uploadlazy`` target (no dependencies to framework libs, ELF and etc.) * Allowed to skip default packages via ``platformio install --skip-default-package`` flag +* Added tools for Raspberry Pi platform +* Added support for Microduino and Raspduino boards in ``atmelavr`` platform 0.3.1 (2014-06-21) diff --git a/README.rst b/README.rst index fef447ceea..4d8dd77069 100644 --- a/README.rst +++ b/README.rst @@ -110,6 +110,17 @@ Platform ``atmelavr`` * ``pro8MHzatmega328`` Arduino Pro or Pro Mini (ATmega328, 3.3V, 8MHz) * ``pro16MHzatmega328`` Arduino Pro or Pro Mini (ATmega328, 5V, 16MHz) * ``uno`` Arduino Uno +* ``raspduino`` Raspduino +* ``328p8m`` Microduino Core (ATmega328P, 3.3V, 8MHz) +* ``328p16m`` Microduino Core (Atmega328P, 5V, 16MHz) +* ``168pa8m`` Microduino Core (ATmega168PA, 3.3V, 8MHz) +* ``168pa16m`` Microduino Core (ATmega168PA, 5V, 16MHz) +* ``644pa8m`` Microduino Core+ (ATmega644PA, 3.3V, 8MHz) +* ``644pa16m`` Microduino Core+ (ATmega644PA, 5V, 16MHz) +* ``1284p8m`` Microduino-Core+ (ATmega1284P, 3.3V, 8MHz) +* ``1284p16m`` Microduino-Core+ (ATmega1284P, 5V, 16MHz) +* ``32u416m`` Microduino-Core USB (ATmega32U4, 5V, 16MHz) + Platform ``timsp430`` From 3bd1fe51abeeb50853d522ce60fd971e8ba1cf65 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 31 Jul 2014 16:20:31 +0300 Subject: [PATCH 24/25] Improved system type detection --- platformio/builder/scripts/atmelavr.py | 1 - platformio/builder/scripts/timsp430.py | 6 ++---- platformio/builder/scripts/titiva.py | 1 - platformio/pkgmanager.py | 8 ++++---- platformio/util.py | 11 +++++++---- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index 96e785522e..6cb008be11 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -12,7 +12,6 @@ from platformio.util import reset_serialport - env = DefaultEnvironment() env.Replace( diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py index dbf1322d83..6a82a0e3da 100644 --- a/platformio/builder/scripts/timsp430.py +++ b/platformio/builder/scripts/timsp430.py @@ -7,13 +7,11 @@ """ from os.path import join +from platform import system from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, DefaultEnvironment) -from platformio.util import get_system - - env = DefaultEnvironment() env.Replace( @@ -55,7 +53,7 @@ UPLOADER=join("$PLATFORMTOOLS_DIR", "mspdebug", "mspdebug"), UPLOADERFLAGS=[ - "$UPLOAD_PROTOCOL" if get_system() != "windows32" else "tilib", + "$UPLOAD_PROTOCOL" if system() != "Windows" else "tilib", "--force-reset" ], UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"' diff --git a/platformio/builder/scripts/titiva.py b/platformio/builder/scripts/titiva.py index ab2ad8b853..ffb538d026 100644 --- a/platformio/builder/scripts/titiva.py +++ b/platformio/builder/scripts/titiva.py @@ -11,7 +11,6 @@ from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, DefaultEnvironment) - env = DefaultEnvironment() env.Replace( diff --git a/platformio/pkgmanager.py b/platformio/pkgmanager.py index 6822acbc80..11c0699140 100644 --- a/platformio/pkgmanager.py +++ b/platformio/pkgmanager.py @@ -14,7 +14,7 @@ from platformio.exception import (InvalidPackageVersion, NonSystemPackage, UnknownPackage) from platformio.unpacker import FileUnpacker -from platformio.util import get_home_dir, get_system +from platformio.util import get_home_dir, get_systype class PackageManager(object): @@ -66,11 +66,11 @@ def get_info(self, name, version=None): raise UnknownPackage(name) # check system platform - system = get_system() - builds = ([b for b in manifest[name] if b['system'] == "all" or system + systype = get_systype() + builds = ([b for b in manifest[name] if b['system'] == "all" or systype in b['system']]) if not builds: - raise NonSystemPackage(name, system) + raise NonSystemPackage(name, systype) if version: for b in builds: diff --git a/platformio/util.py b/platformio/util.py index 234085e746..3604c84d34 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -4,7 +4,7 @@ from os import name as os_name from os import getcwd, getenv, listdir, utime from os.path import dirname, expanduser, isfile, join, realpath -from platform import architecture, system +from platform import system, uname from subprocess import PIPE, Popen from time import sleep @@ -18,8 +18,11 @@ from ConfigParser import ConfigParser -def get_system(): - return (system() + architecture()[0][:-3]).lower() +def get_systype(): + if system() == "Windows": + return "windows" + data = uname() + return ("%s_%s" % (data[0], data[4])).lower() def get_home_dir(): @@ -61,7 +64,7 @@ def change_filemtime(path, time): def exec_command(args): - use_shell = get_system() == "windows32" + use_shell = system() == "Windows" p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell) out, err = p.communicate() return dict(out=out.strip(), err=err.strip()) From 771261e2985f5d72c2e1317c53fe385f9aff4678 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 31 Jul 2014 16:26:10 +0300 Subject: [PATCH 25/25] Ready for 0.4.0 release --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 01219250a7..df358fd3fc 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (1, 0, "0-dev") +VERSION = (0, 4, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"