mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Switch to DefaultEnvironment in SCons scripts
This commit is contained in:
@ -54,8 +54,8 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")),
|
||||
exports="env")
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
||||
|
@ -16,8 +16,8 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
||||
|
@ -5,10 +5,9 @@
|
||||
Base for ARM microcontrollers.
|
||||
"""
|
||||
|
||||
from SCons.Script import Builder, Import, Return
|
||||
from SCons.Script import Builder, DefaultEnvironment
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
@ -104,5 +103,3 @@ env.Append(
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Return("env")
|
||||
|
@ -5,10 +5,9 @@
|
||||
Base for Atmel AVR series of microcontrollers
|
||||
"""
|
||||
|
||||
from SCons.Script import Builder, Import, Return
|
||||
from SCons.Script import Builder, DefaultEnvironment
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
AR="avr-ar",
|
||||
@ -92,5 +91,3 @@ env.Append(
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Return("env")
|
||||
|
@ -18,10 +18,9 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu"):
|
||||
env = SConscript(
|
||||
env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
if "cortex" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("cpu", ""):
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
||||
UPLOADERFLAGS=[
|
||||
@ -48,8 +47,8 @@ if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu"):
|
||||
]
|
||||
)
|
||||
else:
|
||||
env = SConscript(env.subst(
|
||||
join("$PIOBUILDER_DIR", "scripts", "baseavr.py")), exports="env")
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-micronucleus", "micronucleus"),
|
||||
UPLOADERFLAGS=[
|
||||
@ -71,7 +70,7 @@ target_elf = env.BuildFirmware(["m"] + CORELIBS)
|
||||
# Target: Build the firmware file
|
||||
#
|
||||
|
||||
if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu"):
|
||||
if "cortex" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("cpu", ""):
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
|
@ -8,10 +8,9 @@
|
||||
from os import listdir, walk
|
||||
from os.path import isfile, join
|
||||
|
||||
from SCons.Script import Import, Return
|
||||
from SCons.Script import DefaultEnvironment, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
BOARD_OPTS = env.get("BOARD_OPTIONS", {})
|
||||
BOARD_BUILDOPTS = BOARD_OPTS.get("build", {})
|
||||
@ -179,4 +178,4 @@ if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam":
|
||||
join("$PLATFORMFW_DIR", "system", "libsam", "source")
|
||||
))
|
||||
|
||||
Return("env libs")
|
||||
Return("libs")
|
||||
|
@ -7,10 +7,9 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import Import, Return
|
||||
from SCons.Script import DefaultEnvironment, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-cmsis")
|
||||
@ -40,4 +39,4 @@ libs.append(envsafe.BuildLibrary(
|
||||
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
|
||||
))
|
||||
|
||||
Return("env libs")
|
||||
Return("libs")
|
||||
|
@ -7,10 +7,9 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import Import, Return
|
||||
from SCons.Script import DefaultEnvironment, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-energia${PLATFORM[2:]}")
|
||||
@ -53,4 +52,4 @@ libs.append(env.BuildLibrary(
|
||||
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
|
||||
))
|
||||
|
||||
Return("env libs")
|
||||
Return("libs")
|
||||
|
@ -9,12 +9,11 @@ import re
|
||||
from os import listdir, sep, walk
|
||||
from os.path import isfile, join, normpath
|
||||
|
||||
from SCons.Script import Import, Return
|
||||
from SCons.Script import DefaultEnvironment, Return
|
||||
|
||||
from platformio.util import exec_command
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-opencm3")
|
||||
@ -169,4 +168,4 @@ libs.append(env.Library(
|
||||
get_source_files(root_dir)
|
||||
))
|
||||
|
||||
Return("env libs")
|
||||
Return("libs")
|
||||
|
@ -7,10 +7,9 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import Import, Return
|
||||
from SCons.Script import DefaultEnvironment, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl")
|
||||
@ -62,4 +61,4 @@ libs.append(envsafe.BuildLibrary(
|
||||
ignore_files
|
||||
))
|
||||
|
||||
Return("env libs")
|
||||
Return("libs")
|
||||
|
@ -12,8 +12,8 @@ from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
||||
|
@ -13,12 +13,9 @@ from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
env = DefaultEnvironment()
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy":
|
||||
env = SConscript(env.subst(
|
||||
join("$PIOBUILDER_DIR", "scripts", "baseavr.py")), exports="env")
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")))
|
||||
elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3":
|
||||
env = SConscript(env.subst(
|
||||
join("$PIOBUILDER_DIR", "scripts", "basearm.py")), exports="env")
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
|
@ -12,8 +12,8 @@ from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-lm4flash", "lm4flash"),
|
||||
|
@ -27,11 +27,10 @@ def ProcessGeneral(env):
|
||||
env.ConvertInoToCpp()
|
||||
for f in env['FRAMEWORK'].split(","):
|
||||
SConscriptChdir(0)
|
||||
env, libs = SConscript(
|
||||
env.subst(join("$PIOBUILDER_DIR", "scripts",
|
||||
"frameworks", "%s.py" % f.strip().lower())),
|
||||
exports="env")
|
||||
corelibs += libs
|
||||
corelibs += SConscript(
|
||||
env.subst(join("$PIOBUILDER_DIR", "scripts", "frameworks",
|
||||
"%s.py" % f.strip().lower()))
|
||||
)
|
||||
return corelibs
|
||||
|
||||
|
||||
@ -341,7 +340,7 @@ def AutodetectUploadPort(env):
|
||||
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'])
|
||||
print "Auto-detected UPLOAD_PORT: %s" % item['port']
|
||||
env.Replace(UPLOAD_PORT=item['port'])
|
||||
break
|
||||
|
||||
|
Reference in New Issue
Block a user