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-??) 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 * Fixed issue with ``platformio init --ide`` command for Python 2.6
2.10.3 (2016-06-15) 2.10.3 (2016-06-15)

View File

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

View File

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

View File

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

View File

@ -122,8 +122,8 @@ def ConvertInoToCpp(env):
remove(file_) remove(file_)
except: # pylint: disable=bare-except except: # pylint: disable=bare-except
if isfile(file_): if isfile(file_):
print ("Warning: Could not remove temporary file '%s'. " print("Warning: Could not remove temporary file '%s'. "
"Please remove it manually." % file_) "Please remove it manually." % file_)
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) + ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
env.Glob(join("$PROJECTSRC_DIR", "*.pde"))) env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
@ -204,9 +204,7 @@ def DumpIDEData(env):
def get_defines(env_): def get_defines(env_):
defines = [] defines = []
# global symbols # global symbols
for item in env_.get("CPPDEFINES", []): for item in env.Flatten(env_.get("CPPDEFINES", [])):
if isinstance(item, list):
item = "=".join(item)
defines.append(env_.subst(item).replace('\\"', '"')) defines.append(env_.subst(item).replace('\\"', '"'))
# special symbol for Atmel AVR MCU # special symbol for Atmel AVR MCU
@ -233,9 +231,7 @@ def DumpIDEData(env):
# https://github.com/platformio/platformio-atom-ide/issues/34 # https://github.com/platformio/platformio-atom-ide/issues/34
_new_defines = [] _new_defines = []
for item in env_.get("CPPDEFINES", []): for item in env.Flatten(env_.get("CPPDEFINES", [])):
if isinstance(item, list):
item = "=".join(item)
item = item.replace('\\"', '"') item = item.replace('\\"', '"')
if " " in item: if " " in item:
_new_defines.append(item.replace(" ", "\\\\ ")) _new_defines.append(item.replace(" ", "\\\\ "))

View File

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