Apply YAPF
This commit is contained in:
@@ -74,17 +74,22 @@ def DumpIDEData(env):
|
||||
data = {
|
||||
"libsource_dirs":
|
||||
[env.subst(l) for l in env.get("LIBSOURCE_DIRS", [])],
|
||||
"defines": dump_defines(env),
|
||||
"includes": dump_includes(env),
|
||||
"cc_flags": env.subst(LINTCCOM),
|
||||
"cxx_flags": env.subst(LINTCXXCOM),
|
||||
"cc_path": util.where_is_program(
|
||||
env.subst("$CC"), env.subst("${ENV['PATH']}")),
|
||||
"cxx_path": util.where_is_program(
|
||||
env.subst("$CXX"), env.subst("${ENV['PATH']}")),
|
||||
"gdb_path": util.where_is_program(
|
||||
env.subst("$GDB"), env.subst("${ENV['PATH']}")),
|
||||
"prog_path": env.subst("$PROG_PATH")
|
||||
"defines":
|
||||
dump_defines(env),
|
||||
"includes":
|
||||
dump_includes(env),
|
||||
"cc_flags":
|
||||
env.subst(LINTCCOM),
|
||||
"cxx_flags":
|
||||
env.subst(LINTCXXCOM),
|
||||
"cc_path":
|
||||
util.where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
|
||||
"cxx_path":
|
||||
util.where_is_program(env.subst("$CXX"), env.subst("${ENV['PATH']}")),
|
||||
"gdb_path":
|
||||
util.where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")),
|
||||
"prog_path":
|
||||
env.subst("$PROG_PATH")
|
||||
}
|
||||
|
||||
env_ = env.Clone()
|
||||
|
||||
@@ -39,8 +39,8 @@ class LibBuilderFactory(object):
|
||||
clsname = "PlatformIOLibBuilder"
|
||||
else:
|
||||
used_frameworks = LibBuilderFactory.get_used_frameworks(env, path)
|
||||
common_frameworks = (set(env.get("PIOFRAMEWORK", [])) &
|
||||
set(used_frameworks))
|
||||
common_frameworks = (
|
||||
set(env.get("PIOFRAMEWORK", [])) & set(used_frameworks))
|
||||
if common_frameworks:
|
||||
clsname = "%sLibBuilder" % list(common_frameworks)[0].title()
|
||||
elif used_frameworks:
|
||||
@@ -134,8 +134,10 @@ class LibBuilderBase(object):
|
||||
@property
|
||||
def src_filter(self):
|
||||
return piotool.SRC_FILTER_DEFAULT + [
|
||||
"-<example%s>" % os.sep, "-<examples%s>" % os.sep, "-<test%s>" %
|
||||
os.sep, "-<tests%s>" % os.sep
|
||||
"-<example%s>" % os.sep,
|
||||
"-<examples%s>" % os.sep,
|
||||
"-<test%s>" % os.sep,
|
||||
"-<tests%s>" % os.sep
|
||||
]
|
||||
|
||||
@property
|
||||
@@ -247,8 +249,9 @@ class LibBuilderBase(object):
|
||||
if (key in item and
|
||||
not self.items_in_list(self.env[env_key], item[key])):
|
||||
if self.verbose:
|
||||
sys.stderr.write("Skip %s incompatible dependency %s\n"
|
||||
% (key[:-1], item))
|
||||
sys.stderr.write(
|
||||
"Skip %s incompatible dependency %s\n" % (key[:-1],
|
||||
item))
|
||||
skip = True
|
||||
if skip:
|
||||
continue
|
||||
@@ -337,8 +340,8 @@ class LibBuilderBase(object):
|
||||
if _already_depends(lb):
|
||||
if self.verbose:
|
||||
sys.stderr.write("Warning! Circular dependencies detected "
|
||||
"between `%s` and `%s`\n" %
|
||||
(self.path, lb.path))
|
||||
"between `%s` and `%s`\n" % (self.path,
|
||||
lb.path))
|
||||
self._circular_deps.append(lb)
|
||||
elif lb not in self._depbuilders:
|
||||
self._depbuilders.append(lb)
|
||||
@@ -604,14 +607,14 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches
|
||||
if compat_mode > 1 and not lb.is_platforms_compatible(
|
||||
env['PIOPLATFORM']):
|
||||
if verbose:
|
||||
sys.stderr.write("Platform incompatible library %s\n" %
|
||||
lb.path)
|
||||
sys.stderr.write(
|
||||
"Platform incompatible library %s\n" % lb.path)
|
||||
return False
|
||||
if compat_mode > 0 and "PIOFRAMEWORK" in env and \
|
||||
not lb.is_frameworks_compatible(env.get("PIOFRAMEWORK", [])):
|
||||
if verbose:
|
||||
sys.stderr.write("Framework incompatible library %s\n" %
|
||||
lb.path)
|
||||
sys.stderr.write(
|
||||
"Framework incompatible library %s\n" % lb.path)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ class InoToCPPConverter(object):
|
||||
self.env.Execute(
|
||||
self.env.VerboseAction(
|
||||
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(
|
||||
out_file, tmp_path), "Converting " + basename(
|
||||
out_file[:-4])))
|
||||
out_file,
|
||||
tmp_path), "Converting " + basename(out_file[:-4])))
|
||||
atexit.register(_delete_file, tmp_path)
|
||||
return isfile(out_file)
|
||||
|
||||
@@ -139,8 +139,8 @@ class InoToCPPConverter(object):
|
||||
prototypes = []
|
||||
reserved_keywords = set(["if", "else", "while"])
|
||||
for match in self.PROTOTYPE_RE.finditer(contents):
|
||||
if (set([match.group(2).strip(), match.group(3).strip()]) &
|
||||
reserved_keywords):
|
||||
if (set([match.group(2).strip(),
|
||||
match.group(3).strip()]) & reserved_keywords):
|
||||
continue
|
||||
prototypes.append(match)
|
||||
return prototypes
|
||||
|
||||
@@ -81,7 +81,8 @@ def LoadPioPlatform(env, variables):
|
||||
board_config = env.BoardConfig()
|
||||
for k in variables.keys():
|
||||
if (k in env or
|
||||
not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])):
|
||||
not any([k.startswith("BOARD_"),
|
||||
k.startswith("UPLOAD_")])):
|
||||
continue
|
||||
_opt, _val = k.lower().split("_", 1)
|
||||
if _opt == "board":
|
||||
|
||||
@@ -107,8 +107,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
def _look_for_mbed_disk():
|
||||
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
||||
for item in util.get_logicaldisks():
|
||||
if item['disk'].startswith("/net") or not _is_match_pattern(
|
||||
item['disk']):
|
||||
if item['disk'].startswith(
|
||||
"/net") or not _is_match_pattern(item['disk']):
|
||||
continue
|
||||
mbed_pages = [
|
||||
join(item['disk'], n) for n in ("mbed.htm", "mbed.html")
|
||||
@@ -201,8 +201,8 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621
|
||||
|
||||
if used_size > max_size:
|
||||
sys.stderr.write("Error: The program size (%d bytes) is greater "
|
||||
"than maximum allowed (%s bytes)\n" %
|
||||
(used_size, max_size))
|
||||
"than maximum allowed (%s bytes)\n" % (used_size,
|
||||
max_size))
|
||||
env.Exit(1)
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-<svn%s>" % sep]
|
||||
def BuildProgram(env):
|
||||
|
||||
def _append_pio_macros():
|
||||
env.AppendUnique(CPPDEFINES=[(
|
||||
"PLATFORMIO",
|
||||
int("{0:02d}{1:02d}{2:02d}".format(*pioversion_to_intstr())))])
|
||||
env.AppendUnique(CPPDEFINES=[
|
||||
("PLATFORMIO",
|
||||
int("{0:02d}{1:02d}{2:02d}".format(*pioversion_to_intstr())))
|
||||
])
|
||||
|
||||
_append_pio_macros()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user