Temporary disabled "CPPDEFINES" which contain space and break PlatformIO IDE Linter

This commit is contained in:
Ivan Kravets
2016-02-03 01:37:43 +02:00
parent 8a2789fe3f
commit c3f78d1977
6 changed files with 43 additions and 27 deletions

View File

@ -4,6 +4,13 @@ Release Notes
PlatformIO 2.0
--------------
2.8.4 (2016-02-??)
~~~~~~~~~~~~~~~~~~
* Temporary disabled ``CPPDEFINES`` which contain space and break PlatformIO
IDE Linter
(`IDE issue #34 <https://github.com/platformio/platformio-atom-ide/issues/34>`_)
2.8.3 (2016-02-02)
~~~~~~~~~~~~~~~~~~

View File

@ -14,7 +14,7 @@
import sys
VERSION = (2, 8, 3)
VERSION = (2, 8, "4.dev0")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -141,27 +141,27 @@ def DumpIDEData(env):
BOARD_CORE = env.get("BOARD_OPTIONS", {}).get("build", {}).get("core")
def get_includes():
def get_includes(env_):
includes = []
# includes from used framework and libs
for item in env.get("VARIANT_DIRS", []):
for item in env_.get("VARIANT_DIRS", []):
if "$BUILDSRC_DIR" in item[0]:
continue
includes.append(env.subst(item[1]))
includes.append(env_.subst(item[1]))
# custom includes
for item in env.get("CPPPATH", []):
for item in env_.get("CPPPATH", []):
if item.startswith("$BUILD_DIR"):
continue
includes.append(env.subst(item))
includes.append(env_.subst(item))
# installed libs
for d in env.get("LIBSOURCE_DIRS", []):
lsd_dir = env.subst(d)
_append_lib_includes(lsd_dir, includes)
for d in env_.get("LIBSOURCE_DIRS", []):
lsd_dir = env_.subst(d)
_append_lib_includes(env_, lsd_dir, includes)
# includes from toolchain
toolchain_dir = env.subst(
toolchain_dir = env_.subst(
join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN"))
toolchain_incglobs = [
join(toolchain_dir, "*", "include*"),
@ -172,19 +172,19 @@ def DumpIDEData(env):
return includes
def _append_lib_includes(libs_dir, includes):
def _append_lib_includes(env_, libs_dir, includes):
if not isdir(libs_dir):
return
for name in env.get("LIB_USE", []) + sorted(listdir(libs_dir)):
for name in env_.get("LIB_USE", []) + sorted(listdir(libs_dir)):
if not isdir(join(libs_dir, name)):
continue
# ignore user's specified libs
if name in env.get("LIB_IGNORE", []):
if name in env_.get("LIB_IGNORE", []):
continue
if name == "__cores__":
if isdir(join(libs_dir, name, BOARD_CORE)):
_append_lib_includes(
join(libs_dir, name, BOARD_CORE), includes)
env_, join(libs_dir, name, BOARD_CORE), includes)
return
include = (
@ -195,16 +195,16 @@ def DumpIDEData(env):
if include not in includes:
includes.append(include)
def get_defines():
def get_defines(env_):
defines = []
# global symbols
for item in env.get("CPPDEFINES", []):
for item in 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
board = env.get("BOARD_OPTIONS", {})
board = env_.get("BOARD_OPTIONS", {})
if board and board['platform'] == "atmelavr":
defines.append(
"__AVR_%s__" % board['build']['mcu'].upper()
@ -213,14 +213,23 @@ def DumpIDEData(env):
)
return defines
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 {
"defines": get_defines(),
"includes": get_includes(),
"cc_flags": env.subst("$SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"),
"cxx_flags": env.subst(
"defines": get_defines(env_),
"includes": get_includes(env_),
"cc_flags": env_.subst("$SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"),
"cxx_flags": env_.subst(
"$SHCXXFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"),
"cxx_path": where_is_program(
env.subst("$CXX"), env.subst("${ENV['PATH']}"))
env_.subst("$CXX"), env_.subst("${ENV['PATH']}"))
}

View File

@ -2,5 +2,5 @@
-I{{include}}
% end
% for define in defines:
-D{{define}}
-D{{!define}}
% end

View File

@ -1,7 +1,7 @@
{
"execPath": "{{ cxx_path.replace("\\", "/") }}",
"gccDefaultCFlags": "-fsyntax-only {{ cc_flags.replace(' -MMD ', ' ') }}",
"gccDefaultCppFlags": "-fsyntax-only {{ cxx_flags.replace(' -MMD ', ' ') }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\"') }}",
"gccErrorLimit": 15,
"gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}",
"gccSuppressWarnings": false

View File

@ -2,5 +2,5 @@
-I{{include}}
% end
% for define in defines:
-D{{define}}
-D{{!define}}
% end