Fix issue with "CPPDEFINES" which contain space and break PlatformIO IDE Linter

This commit is contained in:
Ivan Kravets
2016-02-10 17:16:52 +02:00
parent c3f78d1977
commit b17acd7605
2 changed files with 19 additions and 9 deletions

View File

@ -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 <https://github.com/platformio/platformio-atom-ide/issues/34>`_)

View File

@ -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: