Merge branch 'develop' into feature/platformio-30

* develop:
  Use env.Flatten to manipulate with CPPDEFINES
  Update name of the OpenEnergyMonitor board // Resolve #699
  Fix PyLint warning
  Remove duplicated flags // Issue #698
  Disable dependancy info
  Revert back previous LINKFLAGS
  Better removing unnecessary flags using ``build_unflags`` option // Resolve #698
  Fix unnecessary uppercase for target includes
This commit is contained in:
Ivan Kravets
2016-06-19 19:21:07 +03:00
6 changed files with 36 additions and 35 deletions

View File

@ -20,6 +20,8 @@ PlatformIO 2.0
2.10.4 (2016-06-??)
~~~~~~~~~~~~~~~~~~~
* Better removing unnecessary flags using ``build_unflags`` option
(`issue #698 <https://github.com/platformio/platformio/issues/698>`_)
* Fixed issue with ``platformio init --ide`` command for Python 2.6
2.10.3 (2016-06-15)

View File

@ -1211,7 +1211,7 @@ OpenEnergyMonitor
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- `OpenEnergyMonitor emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb

View File

@ -826,7 +826,7 @@ OpenEnergyMonitor
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- `OpenEnergyMonitor emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb

View File

@ -1576,7 +1576,7 @@ OpenEnergyMonitor
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- `OpenEnergyMonitor emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb

View File

@ -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")))
@ -204,9 +204,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
@ -233,9 +231,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(" ", "\\\\ "))

View File

@ -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()
@ -53,12 +50,12 @@ def BuildProgram(env):
)
# process extra flags from board
if "BOARD" in env and "build.extra_flags" in env.BoardConfig():
env.ProcessFlags([env.BoardConfig().get("build.extra_flags")])
if "BOARD" in env:
env.ProcessFlags(env.BoardConfig().get("build.extra_flags"))
# remove base flags
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
# apply user flags
env.ProcessFlags([env.get("BUILD_FLAGS")])
env.ProcessFlags(env.get("BUILD_FLAGS"))
if env.get("FRAMEWORK"):
env.BuildFrameworks([
@ -87,7 +84,7 @@ def BuildProgram(env):
)
# Handle SRC_BUILD_FLAGS
env.ProcessFlags([env.get("SRC_BUILD_FLAGS", None)])
env.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
env.Append(
CPPPATH=["$PROJECTSRC_DIR"],
@ -119,18 +116,17 @@ def BuildProgram(env):
def ProcessFlags(env, flags):
for f in flags:
if not f:
if not flags:
return
parsed_flags = env.ParseFlags(str(flags))
for flag in parsed_flags.pop("CPPDEFINES"):
if not isinstance(flag, list):
env.Append(CPPDEFINES=flag)
continue
parsed_flags = env.ParseFlags(str(f))
for flag in parsed_flags.pop("CPPDEFINES"):
if not isinstance(flag, list):
env.Append(CPPDEFINES=flag)
continue
if '\"' in flag[1]:
flag[1] = flag[1].replace('\"', '\\\"')
env.Append(CPPDEFINES=[flag])
env.Append(**parsed_flags)
if '\"' in flag[1]:
flag[1] = flag[1].replace('\"', '\\\"')
env.Append(CPPDEFINES=[flag])
env.Append(**parsed_flags)
# fix relative CPPPATH & LIBPATH
for k in ("CPPPATH", "LIBPATH"):
@ -155,10 +151,17 @@ def ProcessFlags(env, flags):
def ProcessUnFlags(env, flags):
if not flags:
return
for var, values in env.ParseFlags(flags).items():
for v in values:
if v in env[var]:
env[var].remove(v)
parsed_flags = env.ParseFlags(flags)
all_flags = []
for items in parsed_flags.values():
all_flags.extend(items)
all_flags = set(all_flags)
for key in parsed_flags.keys():
cur_flags = set(env.get(key, []))
for item in cur_flags & all_flags:
while item in env[key]:
env[key].remove(item)
def IsFileWithExt(env, file_, ext): # pylint: disable=W0613