From f842898102aa280d1a152d034a160c0a275f6b54 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Dec 2015 18:38:32 +0200 Subject: [PATCH 1/3] Remove "future" code --- .../builder/scripts/frameworks/platformio.py | 61 ------------------- platformio/builder/tools/platformio.py | 33 +++++----- 2 files changed, 15 insertions(+), 79 deletions(-) delete mode 100644 platformio/builder/scripts/frameworks/platformio.py diff --git a/platformio/builder/scripts/frameworks/platformio.py b/platformio/builder/scripts/frameworks/platformio.py deleted file mode 100644 index 927001e7..00000000 --- a/platformio/builder/scripts/frameworks/platformio.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2014-2015 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -PlatformIO - -PlatformIO Framework is an open source light-weight framework with -high-level API for cross-platform embedded programming. It lies above popular -middleware (HAL, SDK) and leverages all its benefits. This approach allowed to -incorporate different development platforms ranging from 8-bits AVR to powerful -32-bit ARM into the one embedded ecosystem. - -http://platformio.org -""" - -from os.path import join - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-platformio") -) - -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkPlatformIO"), - join("$PLATFORMFW_DIR", "src", "api") -) - -env.Append( - CPPPATH=[ - join("$BUILD_DIR", "FrameworkCMSIS"), - join("$BUILD_DIR", "FrameworkCMSISVariant") - ] -) - -envsafe = env.Clone() - -# -# Target: Build Core Library -# - -libs = [] -libs.append(envsafe.BuildLibrary( - join("$BUILD_DIR", "FrameworkCMSISVariant"), - join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}") -)) - -env.Append(LIBS=libs) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 790ea4ad..ec9d4049 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -44,9 +44,7 @@ def BuildProgram(env): env.get("BUILD_FLAGS"), getenv("PLATFORMIO_BUILD_FLAGS"), ]) - - env.BuildFrameworks([ - f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")]) + env.BuildFramework() # build dependent libs deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR") @@ -166,24 +164,23 @@ def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None): return sources -def BuildFrameworks(env, frameworks): - if not frameworks or "uploadlazy" in COMMAND_LINE_TARGETS: +def BuildFramework(env): + if "FRAMEWORK" not in env or "uploadlazy" in COMMAND_LINE_TARGETS: return - board_frameworks = env.get("BOARD_OPTIONS", {}).get("frameworks") - if frameworks == ["platformio"]: - if board_frameworks: - frameworks.insert(0, board_frameworks[0]) + if env['FRAMEWORK'].lower() in ("arduino", "energia"): + env.ConvertInoToCpp() - for f in frameworks: - if f in ("arduino", "energia"): - env.ConvertInoToCpp() - - if f in board_frameworks: - SConscript(env.subst( - join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f))) + for f in env['FRAMEWORK'].split(","): + framework = f.strip().lower() + if framework in env.get("BOARD_OPTIONS", {}).get("frameworks"): + SConscript( + env.subst(join("$PIOBUILDER_DIR", "scripts", "frameworks", + "%s.py" % framework)) + ) else: - Exit("Error: This board doesn't support %s framework!" % f) + Exit("Error: This board doesn't support %s framework!" % + framework) def BuildLibrary(env, variant_dir, src_dir, src_filter=None): @@ -347,7 +344,7 @@ def generate(env): env.AddMethod(IsFileWithExt) env.AddMethod(VariantDirWrap) env.AddMethod(LookupSources) - env.AddMethod(BuildFrameworks) + env.AddMethod(BuildFramework) env.AddMethod(BuildLibrary) env.AddMethod(BuildDependentLibraries) return env From 84e82dd39add1699a43b2af9b9e757b7a418ed96 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Dec 2015 19:00:40 +0200 Subject: [PATCH 2/3] Restore PLATFORMIO macros with the current version --- HISTORY.rst | 5 +++++ platformio/__init__.py | 2 +- platformio/builder/main.py | 6 ------ platformio/builder/tools/platformio.py | 7 +++++++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 652cbffd..90b5e16e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,11 @@ Release History PlatformIO 2.0 -------------- +2.4.1 (2015-12-??) +~~~~~~~~~~~~~~~~~~ + +* Restored ``PLATFORMIO`` macros with the current version + 2.4.0 (2015-12-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 0ef276d8..b8b332f9 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (2, 4, 0) +VERSION = (2, 4, "1.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 5b45692e..b3c1b34a 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -114,12 +114,6 @@ DefaultEnvironment( env = DefaultEnvironment() -# Append PlatformIO version -env.Append( - CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format( - *util.pioversion_to_intstr())] -) - if "BOARD" in env: try: env.Replace(BOARD_OPTIONS=util.get_boards(env.subst("$BOARD"))) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index ec9d4049..c9e82a22 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -23,6 +23,8 @@ from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit, SConscript) from SCons.Util import case_sensitive_suffixes +from platformio.util import pioversion_to_intstr + SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_HEADER_EXT = ["h", "hpp"] SRC_DEFAULT_FILTER = " ".join([ @@ -71,6 +73,11 @@ def BuildProgram(env): getenv("PLATFORMIO_SRC_BUILD_FLAGS"), ]) + env.Append( + CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format( + *pioversion_to_intstr())] + ) + return env.Program( join("$BUILD_DIR", env.subst("$PROGNAME")), env.LookupSources( From ef5fa4dea097120238ed969b75291b1e31ea4cca Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Dec 2015 19:02:01 +0200 Subject: [PATCH 3/3] Version bump to 2.4.1 --- HISTORY.rst | 2 +- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 90b5e16e..2839f032 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Release History PlatformIO 2.0 -------------- -2.4.1 (2015-12-??) +2.4.1 (2015-12-01) ~~~~~~~~~~~~~~~~~~ * Restored ``PLATFORMIO`` macros with the current version diff --git a/platformio/__init__.py b/platformio/__init__.py index b8b332f9..2b369209 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (2, 4, "1.dev0") +VERSION = (2, 4, 1) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"