diff --git a/HISTORY.rst b/HISTORY.rst index 3fcd121a..a63a32dd 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,7 +7,7 @@ PlatformIO 2.0 2.8.4 (2016-02-??) ~~~~~~~~~~~~~~~~~~ -* Temporary disabled ``CPPDEFINES`` which contain space and break PlatformIO +* Fixed issue with ``CPPDEFINES`` which contain space and break PlatformIO IDE Linter (`IDE issue #34 `_) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 83db55ec..e366b821 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -215,14 +215,7 @@ def DumpIDEData(env): env_ = env.Clone() - # TODO tmp fix https://github.com/platformio/platformio-atom-ide/issues/34 - _new_defines = [] - for item in env_.get("CPPDEFINES", []): - if " " not in item: - _new_defines.append(item) - env_.Replace(CPPDEFINES=_new_defines) - - return { + data = { "defines": get_defines(env_), "includes": get_includes(env_), "cc_flags": env_.subst("$SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"), @@ -232,6 +225,23 @@ def DumpIDEData(env): env_.subst("$CXX"), env_.subst("${ENV['PATH']}")) } + # https://github.com/platformio/platformio-atom-ide/issues/34 + _new_defines = [] + for item in env_.get("CPPDEFINES", []): + if " " in item: + _new_defines.append(item.replace(" ", "\\\\ ")) + else: + _new_defines.append(item) + env_.Replace(CPPDEFINES=_new_defines) + + data.update({ + "cc_flags": env_.subst("$SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"), + "cxx_flags": env_.subst( + "$SHCXXFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS") + }) + + return data + def GetCompilerType(env): try: