mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Drop Click to (5.1) <6 // Issue #346
This commit is contained in:
61
platformio/builder/scripts/frameworks/platformio.py
Normal file
61
platformio/builder/scripts/frameworks/platformio.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
|
||||||
|
#
|
||||||
|
# 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)
|
@ -44,7 +44,9 @@ def BuildProgram(env):
|
|||||||
env.get("BUILD_FLAGS"),
|
env.get("BUILD_FLAGS"),
|
||||||
getenv("PLATFORMIO_BUILD_FLAGS"),
|
getenv("PLATFORMIO_BUILD_FLAGS"),
|
||||||
])
|
])
|
||||||
env.BuildFramework()
|
|
||||||
|
env.BuildFrameworks([
|
||||||
|
f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")])
|
||||||
|
|
||||||
# build dependent libs
|
# build dependent libs
|
||||||
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
|
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
|
||||||
@ -164,23 +166,24 @@ def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None):
|
|||||||
return sources
|
return sources
|
||||||
|
|
||||||
|
|
||||||
def BuildFramework(env):
|
def BuildFrameworks(env, frameworks):
|
||||||
if "FRAMEWORK" not in env or "uploadlazy" in COMMAND_LINE_TARGETS:
|
if not frameworks or "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||||
return
|
return
|
||||||
|
|
||||||
if env['FRAMEWORK'].lower() in ("arduino", "energia"):
|
board_frameworks = env.get("BOARD_OPTIONS", {}).get("frameworks")
|
||||||
env.ConvertInoToCpp()
|
if frameworks == ["platformio"]:
|
||||||
|
if board_frameworks:
|
||||||
|
frameworks.insert(0, board_frameworks[0])
|
||||||
|
|
||||||
for f in env['FRAMEWORK'].split(","):
|
for f in frameworks:
|
||||||
framework = f.strip().lower()
|
if f in ("arduino", "energia"):
|
||||||
if framework in env.get("BOARD_OPTIONS", {}).get("frameworks"):
|
env.ConvertInoToCpp()
|
||||||
SConscript(
|
|
||||||
env.subst(join("$PIOBUILDER_DIR", "scripts", "frameworks",
|
if f in board_frameworks:
|
||||||
"%s.py" % framework))
|
SConscript(env.subst(
|
||||||
)
|
join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f)))
|
||||||
else:
|
else:
|
||||||
Exit("Error: This board doesn't support %s framework!" %
|
Exit("Error: This board doesn't support %s framework!" % f)
|
||||||
framework)
|
|
||||||
|
|
||||||
|
|
||||||
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
|
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
|
||||||
@ -344,7 +347,7 @@ def generate(env):
|
|||||||
env.AddMethod(IsFileWithExt)
|
env.AddMethod(IsFileWithExt)
|
||||||
env.AddMethod(VariantDirWrap)
|
env.AddMethod(VariantDirWrap)
|
||||||
env.AddMethod(LookupSources)
|
env.AddMethod(LookupSources)
|
||||||
env.AddMethod(BuildFramework)
|
env.AddMethod(BuildFrameworks)
|
||||||
env.AddMethod(BuildLibrary)
|
env.AddMethod(BuildLibrary)
|
||||||
env.AddMethod(BuildDependentLibraries)
|
env.AddMethod(BuildDependentLibraries)
|
||||||
return env
|
return env
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
bottle==0.12.9
|
bottle==0.12.9
|
||||||
click==6.2
|
click==5.1
|
||||||
colorama==0.3.3
|
colorama==0.3.3
|
||||||
lockfile==0.12.2
|
lockfile==0.12.2
|
||||||
pyserial==2.7
|
pyserial==2.7
|
||||||
|
Reference in New Issue
Block a user