forked from platformio/platformio-core
Prefer global env when generating integration data
This commit is contained in:
@ -145,51 +145,40 @@ def _subst_cmd(env, cmd):
|
|||||||
return " ".join([SCons.Subst.quote_spaces(arg) for arg in args])
|
return " ".join([SCons.Subst.quote_spaces(arg) for arg in args])
|
||||||
|
|
||||||
|
|
||||||
def DumpIntegrationData(env, globalenv):
|
def DumpIntegrationData(*args):
|
||||||
"""env here is `projenv`"""
|
projenv, globalenv = args[0:2] # pylint: disable=unbalanced-tuple-unpacking
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"env_name": env["PIOENV"],
|
"env_name": globalenv["PIOENV"],
|
||||||
"libsource_dirs": [env.subst(item) for item in env.GetLibSourceDirs()],
|
"libsource_dirs": [
|
||||||
"defines": dump_defines(env),
|
globalenv.subst(item) for item in globalenv.GetLibSourceDirs()
|
||||||
"includes": env.DumpIntegrationIncludes(),
|
],
|
||||||
"cc_path": where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
|
"defines": dump_defines(projenv),
|
||||||
"cxx_path": where_is_program(env.subst("$CXX"), env.subst("${ENV['PATH']}")),
|
"includes": projenv.DumpIntegrationIncludes(),
|
||||||
"gdb_path": where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")),
|
"cc_flags": _subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS"),
|
||||||
"prog_path": env.subst("$PROG_PATH"),
|
"cxx_flags": _subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
|
||||||
"svd_path": dump_svd_path(env),
|
"cc_path": where_is_program(
|
||||||
"compiler_type": env.GetCompilerType(),
|
globalenv.subst("$CC"), globalenv.subst("${ENV['PATH']}")
|
||||||
|
),
|
||||||
|
"cxx_path": where_is_program(
|
||||||
|
globalenv.subst("$CXX"), globalenv.subst("${ENV['PATH']}")
|
||||||
|
),
|
||||||
|
"gdb_path": where_is_program(
|
||||||
|
globalenv.subst("$GDB"), globalenv.subst("${ENV['PATH']}")
|
||||||
|
),
|
||||||
|
"prog_path": globalenv.subst("$PROG_PATH"),
|
||||||
|
"svd_path": dump_svd_path(globalenv),
|
||||||
|
"compiler_type": globalenv.GetCompilerType(),
|
||||||
"targets": globalenv.DumpTargets(),
|
"targets": globalenv.DumpTargets(),
|
||||||
"extra": dict(
|
"extra": dict(
|
||||||
flash_images=[
|
flash_images=[
|
||||||
{"offset": item[0], "path": env.subst(item[1])}
|
{"offset": item[0], "path": globalenv.subst(item[1])}
|
||||||
for item in env.get("FLASH_EXTRA_IMAGES", [])
|
for item in globalenv.get("FLASH_EXTRA_IMAGES", [])
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
data["extra"].update(
|
data["extra"].update(
|
||||||
env.get("INTEGRATION_EXTRA_DATA", env.get("IDE_EXTRA_DATA", {}))
|
globalenv.get("INTEGRATION_EXTRA_DATA", globalenv.get("IDE_EXTRA_DATA", {}))
|
||||||
)
|
)
|
||||||
|
|
||||||
env_ = env.Clone()
|
|
||||||
# https://github.com/platformio/platformio-atom-ide/issues/34
|
|
||||||
_new_defines = []
|
|
||||||
for item in SCons.Defaults.processDefines(env_.get("CPPDEFINES", [])):
|
|
||||||
item = item.replace('\\"', '"')
|
|
||||||
if " " in item:
|
|
||||||
_new_defines.append(item.replace(" ", "\\\\ "))
|
|
||||||
else:
|
|
||||||
_new_defines.append(item)
|
|
||||||
env_.Replace(CPPDEFINES=_new_defines)
|
|
||||||
|
|
||||||
# export C/C++ build flags
|
|
||||||
data.update(
|
|
||||||
{
|
|
||||||
"cc_flags": _subst_cmd(env_, "$CFLAGS $CCFLAGS $CPPFLAGS"),
|
|
||||||
"cxx_flags": _subst_cmd(env_, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user