This commit is contained in:
Ivan Kravets
2017-07-24 17:35:41 +03:00
parent 16ea8f29a1
commit f13537cabb
11 changed files with 40 additions and 40 deletions

View File

@ -524,8 +524,8 @@ class PlatformIOLibBuilder(LibBuilderBase):
@property
def src_dir(self):
if all([
"srcFilter" in self._manifest.get("build", {}) or
self.env['SRC_FILTER'], not self._is_arduino_manifest()
"srcFilter" in self._manifest.get("build", {})
or self.env['SRC_FILTER'], not self._is_arduino_manifest()
]):
return self.path
return LibBuilderBase.src_dir.fget(self)
@ -587,9 +587,9 @@ class PlatformIOLibBuilder(LibBuilderBase):
inc_dirs = LibBuilderBase.get_inc_dirs(self)
# backwards compatibility with PlatformIO 2.0
if ("build" not in self._manifest and self._is_arduino_manifest() and
not isdir(join(self.path, "src")) and
isdir(join(self.path, "utility"))):
if ("build" not in self._manifest and self._is_arduino_manifest()
and not isdir(join(self.path, "src"))
and isdir(join(self.path, "utility"))):
inc_dirs.append(join(self.path, "utility"))
for path in self.env.get("CPPPATH", []):
@ -605,8 +605,8 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches
items = []
compat_mode = int(env.get("LIB_COMPAT_MODE", 1))
verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0)) and
not env.GetOption('clean'))
verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0))
and not env.GetOption('clean'))
def _check_lib_builder(lb):
if lb.name in env.get("LIB_IGNORE", []):

View File

@ -80,9 +80,9 @@ 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_")])):
if (k in env
or not any([k.startswith("BOARD_"),
k.startswith("UPLOAD_")])):
continue
_opt, _val = k.lower().split("_", 1)
if _opt == "board":

View File

@ -115,8 +115,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
]
if any([isfile(p) for p in mbed_pages]):
return item['disk']
if (item['name'] and
any([l in item['name'].lower() for l in msdlabels])):
if (item['name']
and any([l in item['name'].lower() for l in msdlabels])):
return item['disk']
return None

View File

@ -66,8 +66,8 @@ def BuildProgram(env):
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
# append specified LD_SCRIPT
if ("LDSCRIPT_PATH" in env and
not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
if ("LDSCRIPT_PATH" in env
and not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'])
# enable "cyclic reference" for linker

View File

@ -385,8 +385,8 @@ def lib_show(library, json_output):
@cli.command("register", short_help="Register a new library")
@click.argument("config_url")
def lib_register(config_url):
if (not config_url.startswith("http://") and
not config_url.startswith("https://")):
if (not config_url.startswith("http://")
and not config_url.startswith("https://")):
raise exception.InvalidLibConfURL(config_url)
result = get_api_result("/lib/register", data=dict(config_url=config_url))

View File

@ -88,8 +88,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
envname = section[4:]
skipenv = any([
environment and envname not in environment, not environment and
env_default and envname not in env_default
environment and envname not in environment, not environment
and env_default and envname not in env_default
])
if skipenv:
results.append((envname, None))
@ -322,8 +322,8 @@ def _clean_pioenvs_dir(pioenvs_dir):
proj_hash = calculate_project_hash()
# if project's config is modified
if (isdir(pioenvs_dir) and
getmtime(join(util.get_project_dir(), "platformio.ini")) >
if (isdir(pioenvs_dir)
and getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(pioenvs_dir)):
util.rmtree_(pioenvs_dir)

View File

@ -66,8 +66,8 @@ def cli():
if not r:
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
permission_errors = ("permission denied", "not permitted")
if (any([m in r['err'].lower() for m in permission_errors]) and
"windows" not in util.get_systype()):
if (any([m in r['err'].lower() for m in permission_errors])
and "windows" not in util.get_systype()):
click.secho(
"""
-----------------

View File

@ -516,8 +516,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
# Handle GitHub URL (https://github.com/user/package)
url.startswith("https://github.com/") and not url.endswith(
(".zip", ".tar.gz")),
url.startswith("http") and
(url.split("#", 1)[0] if "#" in url else url).endswith(".git")
url.startswith("http")
and (url.split("#", 1)[0] if "#" in url else url).endswith(".git")
]
if any(git_conditions):
url = "git+" + url

View File

@ -38,8 +38,8 @@ class PlatformManager(BasePkgManager):
"{0}://dl.platformio.org/platforms/manifest.json".format(
"https" if app.get_setting("enable_ssl") else "http")
]
BasePkgManager.__init__(self, package_dir or
join(util.get_home_dir(), "platforms"),
BasePkgManager.__init__(self, package_dir
or join(util.get_home_dir(), "platforms"),
repositories)
@property
@ -144,8 +144,8 @@ class PlatformManager(BasePkgManager):
for manifest in pm.get_installed():
if manifest['name'] not in names:
continue
if (manifest['name'] not in deppkgs or
manifest['version'] not in deppkgs[manifest['name']]):
if (manifest['name'] not in deppkgs
or manifest['version'] not in deppkgs[manifest['name']]):
pm.uninstall(manifest['__pkg_dir'], trigger_event=False)
self.cache_reset()
@ -168,12 +168,12 @@ class PlatformManager(BasePkgManager):
def board_config(self, id_, platform=None):
for manifest in self.get_installed_boards():
if manifest['id'] == id_ and (not platform or
manifest['platform'] == platform):
if manifest['id'] == id_ and (not platform
or manifest['platform'] == platform):
return manifest
for manifest in self.get_registered_boards():
if manifest['id'] == id_ and (not platform or
manifest['platform'] == platform):
if manifest['id'] == id_ and (not platform
or manifest['platform'] == platform):
return manifest
raise exception.UnknownBoard(id_)
@ -270,8 +270,8 @@ class PlatformPackagesMixin(object):
if _opts.get("type") == item:
candidate = _name
if (self.frameworks and item.startswith("framework-") and
item[10:] in self.frameworks):
if (self.frameworks and item.startswith("framework-")
and item[10:] in self.frameworks):
candidate = self.frameworks[item[10:]]['package']
result.append(candidate)
@ -498,8 +498,8 @@ class PlatformBase( # pylint: disable=too-many-public-methods
config = PlatformBoardConfig(manifest_path)
if "platform" in config and config.get("platform") != self.name:
return
elif ("platforms" in config and
self.name not in config.get("platforms")):
elif ("platforms" in config
and self.name not in config.get("platforms")):
return
config.manifest['platform'] = self.name
self._BOARDS_CACHE[board_id] = config

View File

@ -110,8 +110,8 @@ class MeasurementProtocol(TelemetryBase):
self['cd2'] = "Python/%s %s" % (platform.python_version(),
platform.platform())
self['cd3'] = " ".join(_filter_args(sys.argv[1:]))
self['cd4'] = 1 if (not util.is_ci() and
(caller_id or not util.is_container())) else 0
self['cd4'] = 1 if (not util.is_ci()
and (caller_id or not util.is_container())) else 0
if caller_id:
self['cd5'] = caller_id.lower()

View File

@ -200,8 +200,8 @@ def get_project_optional_dir(name, default=None):
else:
try:
config = load_project_config()
if (config.has_section("platformio") and
config.has_option("platformio", name)):
if (config.has_section("platformio")
and config.has_option("platformio", name)):
data = config.get("platformio", name)
except exception.NotPlatformIOProject:
pass