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