mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Use env.Flatten to manipulate with CPPDEFINES
This commit is contained in:
@ -122,8 +122,8 @@ def ConvertInoToCpp(env):
|
||||
remove(file_)
|
||||
except: # pylint: disable=bare-except
|
||||
if isfile(file_):
|
||||
print ("Warning: Could not remove temporary file '%s'. "
|
||||
"Please remove it manually." % file_)
|
||||
print("Warning: Could not remove temporary file '%s'. "
|
||||
"Please remove it manually." % file_)
|
||||
|
||||
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
|
||||
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
|
||||
@ -202,9 +202,7 @@ def DumpIDEData(env):
|
||||
def get_defines(env_):
|
||||
defines = []
|
||||
# global symbols
|
||||
for item in env_.get("CPPDEFINES", []):
|
||||
if isinstance(item, list):
|
||||
item = "=".join(item)
|
||||
for item in env.Flatten(env_.get("CPPDEFINES", [])):
|
||||
defines.append(env_.subst(item).replace('\\"', '"'))
|
||||
|
||||
# special symbol for Atmel AVR MCU
|
||||
@ -232,9 +230,7 @@ def DumpIDEData(env):
|
||||
|
||||
# https://github.com/platformio/platformio-atom-ide/issues/34
|
||||
_new_defines = []
|
||||
for item in env_.get("CPPDEFINES", []):
|
||||
if isinstance(item, list):
|
||||
item = "=".join(item)
|
||||
for item in env.Flatten(env_.get("CPPDEFINES", [])):
|
||||
item = item.replace('\\"', '"')
|
||||
if " " in item:
|
||||
_new_defines.append(item.replace(" ", "\\\\ "))
|
||||
|
@ -36,12 +36,9 @@ SRC_DEFAULT_FILTER = " ".join([
|
||||
def BuildProgram(env):
|
||||
|
||||
def _append_pio_macros():
|
||||
if any(["PLATFORMIO=" in str(d) for d in env.get("CPPDEFINES", [])]):
|
||||
return
|
||||
env.Append(
|
||||
env.AppendUnique(
|
||||
CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format(
|
||||
*pioversion_to_intstr())],
|
||||
)
|
||||
*pioversion_to_intstr())])
|
||||
|
||||
_append_pio_macros()
|
||||
|
||||
|
Reference in New Issue
Block a user