forked from platformio/platformio-core
YAPF
This commit is contained in:
@ -524,8 +524,8 @@ class PlatformIOLibBuilder(LibBuilderBase):
|
|||||||
@property
|
@property
|
||||||
def src_dir(self):
|
def src_dir(self):
|
||||||
if all([
|
if all([
|
||||||
"srcFilter" in self._manifest.get("build", {}) or
|
"srcFilter" in self._manifest.get("build", {})
|
||||||
self.env['SRC_FILTER'], not self._is_arduino_manifest()
|
or self.env['SRC_FILTER'], not self._is_arduino_manifest()
|
||||||
]):
|
]):
|
||||||
return self.path
|
return self.path
|
||||||
return LibBuilderBase.src_dir.fget(self)
|
return LibBuilderBase.src_dir.fget(self)
|
||||||
@ -587,9 +587,9 @@ class PlatformIOLibBuilder(LibBuilderBase):
|
|||||||
inc_dirs = LibBuilderBase.get_inc_dirs(self)
|
inc_dirs = LibBuilderBase.get_inc_dirs(self)
|
||||||
|
|
||||||
# backwards compatibility with PlatformIO 2.0
|
# backwards compatibility with PlatformIO 2.0
|
||||||
if ("build" not in self._manifest and self._is_arduino_manifest() and
|
if ("build" not in self._manifest and self._is_arduino_manifest()
|
||||||
not isdir(join(self.path, "src")) and
|
and not isdir(join(self.path, "src"))
|
||||||
isdir(join(self.path, "utility"))):
|
and isdir(join(self.path, "utility"))):
|
||||||
inc_dirs.append(join(self.path, "utility"))
|
inc_dirs.append(join(self.path, "utility"))
|
||||||
|
|
||||||
for path in self.env.get("CPPPATH", []):
|
for path in self.env.get("CPPPATH", []):
|
||||||
@ -605,8 +605,8 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches
|
|||||||
|
|
||||||
items = []
|
items = []
|
||||||
compat_mode = int(env.get("LIB_COMPAT_MODE", 1))
|
compat_mode = int(env.get("LIB_COMPAT_MODE", 1))
|
||||||
verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0)) and
|
verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0))
|
||||||
not env.GetOption('clean'))
|
and not env.GetOption('clean'))
|
||||||
|
|
||||||
def _check_lib_builder(lb):
|
def _check_lib_builder(lb):
|
||||||
if lb.name in env.get("LIB_IGNORE", []):
|
if lb.name in env.get("LIB_IGNORE", []):
|
||||||
|
@ -80,9 +80,9 @@ def LoadPioPlatform(env, variables):
|
|||||||
|
|
||||||
board_config = env.BoardConfig()
|
board_config = env.BoardConfig()
|
||||||
for k in variables.keys():
|
for k in variables.keys():
|
||||||
if (k in env or
|
if (k in env
|
||||||
not any([k.startswith("BOARD_"),
|
or not any([k.startswith("BOARD_"),
|
||||||
k.startswith("UPLOAD_")])):
|
k.startswith("UPLOAD_")])):
|
||||||
continue
|
continue
|
||||||
_opt, _val = k.lower().split("_", 1)
|
_opt, _val = k.lower().split("_", 1)
|
||||||
if _opt == "board":
|
if _opt == "board":
|
||||||
|
@ -115,8 +115,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
|||||||
]
|
]
|
||||||
if any([isfile(p) for p in mbed_pages]):
|
if any([isfile(p) for p in mbed_pages]):
|
||||||
return item['disk']
|
return item['disk']
|
||||||
if (item['name'] and
|
if (item['name']
|
||||||
any([l in item['name'].lower() for l in msdlabels])):
|
and any([l in item['name'].lower() for l in msdlabels])):
|
||||||
return item['disk']
|
return item['disk']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ def BuildProgram(env):
|
|||||||
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
|
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
|
||||||
|
|
||||||
# append specified LD_SCRIPT
|
# append specified LD_SCRIPT
|
||||||
if ("LDSCRIPT_PATH" in env and
|
if ("LDSCRIPT_PATH" in env
|
||||||
not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
|
and not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
|
||||||
env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'])
|
env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'])
|
||||||
|
|
||||||
# enable "cyclic reference" for linker
|
# enable "cyclic reference" for linker
|
||||||
|
@ -385,8 +385,8 @@ def lib_show(library, json_output):
|
|||||||
@cli.command("register", short_help="Register a new library")
|
@cli.command("register", short_help="Register a new library")
|
||||||
@click.argument("config_url")
|
@click.argument("config_url")
|
||||||
def lib_register(config_url):
|
def lib_register(config_url):
|
||||||
if (not config_url.startswith("http://") and
|
if (not config_url.startswith("http://")
|
||||||
not config_url.startswith("https://")):
|
and not config_url.startswith("https://")):
|
||||||
raise exception.InvalidLibConfURL(config_url)
|
raise exception.InvalidLibConfURL(config_url)
|
||||||
|
|
||||||
result = get_api_result("/lib/register", data=dict(config_url=config_url))
|
result = get_api_result("/lib/register", data=dict(config_url=config_url))
|
||||||
|
@ -88,8 +88,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
|||||||
|
|
||||||
envname = section[4:]
|
envname = section[4:]
|
||||||
skipenv = any([
|
skipenv = any([
|
||||||
environment and envname not in environment, not environment and
|
environment and envname not in environment, not environment
|
||||||
env_default and envname not in env_default
|
and env_default and envname not in env_default
|
||||||
])
|
])
|
||||||
if skipenv:
|
if skipenv:
|
||||||
results.append((envname, None))
|
results.append((envname, None))
|
||||||
@ -322,8 +322,8 @@ def _clean_pioenvs_dir(pioenvs_dir):
|
|||||||
proj_hash = calculate_project_hash()
|
proj_hash = calculate_project_hash()
|
||||||
|
|
||||||
# if project's config is modified
|
# if project's config is modified
|
||||||
if (isdir(pioenvs_dir) and
|
if (isdir(pioenvs_dir)
|
||||||
getmtime(join(util.get_project_dir(), "platformio.ini")) >
|
and getmtime(join(util.get_project_dir(), "platformio.ini")) >
|
||||||
getmtime(pioenvs_dir)):
|
getmtime(pioenvs_dir)):
|
||||||
util.rmtree_(pioenvs_dir)
|
util.rmtree_(pioenvs_dir)
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ def cli():
|
|||||||
if not r:
|
if not r:
|
||||||
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
||||||
permission_errors = ("permission denied", "not permitted")
|
permission_errors = ("permission denied", "not permitted")
|
||||||
if (any([m in r['err'].lower() for m in permission_errors]) and
|
if (any([m in r['err'].lower() for m in permission_errors])
|
||||||
"windows" not in util.get_systype()):
|
and "windows" not in util.get_systype()):
|
||||||
click.secho(
|
click.secho(
|
||||||
"""
|
"""
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -516,8 +516,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
|||||||
# Handle GitHub URL (https://github.com/user/package)
|
# Handle GitHub URL (https://github.com/user/package)
|
||||||
url.startswith("https://github.com/") and not url.endswith(
|
url.startswith("https://github.com/") and not url.endswith(
|
||||||
(".zip", ".tar.gz")),
|
(".zip", ".tar.gz")),
|
||||||
url.startswith("http") and
|
url.startswith("http")
|
||||||
(url.split("#", 1)[0] if "#" in url else url).endswith(".git")
|
and (url.split("#", 1)[0] if "#" in url else url).endswith(".git")
|
||||||
]
|
]
|
||||||
if any(git_conditions):
|
if any(git_conditions):
|
||||||
url = "git+" + url
|
url = "git+" + url
|
||||||
|
@ -38,8 +38,8 @@ class PlatformManager(BasePkgManager):
|
|||||||
"{0}://dl.platformio.org/platforms/manifest.json".format(
|
"{0}://dl.platformio.org/platforms/manifest.json".format(
|
||||||
"https" if app.get_setting("enable_ssl") else "http")
|
"https" if app.get_setting("enable_ssl") else "http")
|
||||||
]
|
]
|
||||||
BasePkgManager.__init__(self, package_dir or
|
BasePkgManager.__init__(self, package_dir
|
||||||
join(util.get_home_dir(), "platforms"),
|
or join(util.get_home_dir(), "platforms"),
|
||||||
repositories)
|
repositories)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -144,8 +144,8 @@ class PlatformManager(BasePkgManager):
|
|||||||
for manifest in pm.get_installed():
|
for manifest in pm.get_installed():
|
||||||
if manifest['name'] not in names:
|
if manifest['name'] not in names:
|
||||||
continue
|
continue
|
||||||
if (manifest['name'] not in deppkgs or
|
if (manifest['name'] not in deppkgs
|
||||||
manifest['version'] not in deppkgs[manifest['name']]):
|
or manifest['version'] not in deppkgs[manifest['name']]):
|
||||||
pm.uninstall(manifest['__pkg_dir'], trigger_event=False)
|
pm.uninstall(manifest['__pkg_dir'], trigger_event=False)
|
||||||
|
|
||||||
self.cache_reset()
|
self.cache_reset()
|
||||||
@ -168,12 +168,12 @@ class PlatformManager(BasePkgManager):
|
|||||||
|
|
||||||
def board_config(self, id_, platform=None):
|
def board_config(self, id_, platform=None):
|
||||||
for manifest in self.get_installed_boards():
|
for manifest in self.get_installed_boards():
|
||||||
if manifest['id'] == id_ and (not platform or
|
if manifest['id'] == id_ and (not platform
|
||||||
manifest['platform'] == platform):
|
or manifest['platform'] == platform):
|
||||||
return manifest
|
return manifest
|
||||||
for manifest in self.get_registered_boards():
|
for manifest in self.get_registered_boards():
|
||||||
if manifest['id'] == id_ and (not platform or
|
if manifest['id'] == id_ and (not platform
|
||||||
manifest['platform'] == platform):
|
or manifest['platform'] == platform):
|
||||||
return manifest
|
return manifest
|
||||||
raise exception.UnknownBoard(id_)
|
raise exception.UnknownBoard(id_)
|
||||||
|
|
||||||
@ -270,8 +270,8 @@ class PlatformPackagesMixin(object):
|
|||||||
if _opts.get("type") == item:
|
if _opts.get("type") == item:
|
||||||
candidate = _name
|
candidate = _name
|
||||||
|
|
||||||
if (self.frameworks and item.startswith("framework-") and
|
if (self.frameworks and item.startswith("framework-")
|
||||||
item[10:] in self.frameworks):
|
and item[10:] in self.frameworks):
|
||||||
candidate = self.frameworks[item[10:]]['package']
|
candidate = self.frameworks[item[10:]]['package']
|
||||||
|
|
||||||
result.append(candidate)
|
result.append(candidate)
|
||||||
@ -498,8 +498,8 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
|||||||
config = PlatformBoardConfig(manifest_path)
|
config = PlatformBoardConfig(manifest_path)
|
||||||
if "platform" in config and config.get("platform") != self.name:
|
if "platform" in config and config.get("platform") != self.name:
|
||||||
return
|
return
|
||||||
elif ("platforms" in config and
|
elif ("platforms" in config
|
||||||
self.name not in config.get("platforms")):
|
and self.name not in config.get("platforms")):
|
||||||
return
|
return
|
||||||
config.manifest['platform'] = self.name
|
config.manifest['platform'] = self.name
|
||||||
self._BOARDS_CACHE[board_id] = config
|
self._BOARDS_CACHE[board_id] = config
|
||||||
|
@ -110,8 +110,8 @@ class MeasurementProtocol(TelemetryBase):
|
|||||||
self['cd2'] = "Python/%s %s" % (platform.python_version(),
|
self['cd2'] = "Python/%s %s" % (platform.python_version(),
|
||||||
platform.platform())
|
platform.platform())
|
||||||
self['cd3'] = " ".join(_filter_args(sys.argv[1:]))
|
self['cd3'] = " ".join(_filter_args(sys.argv[1:]))
|
||||||
self['cd4'] = 1 if (not util.is_ci() and
|
self['cd4'] = 1 if (not util.is_ci()
|
||||||
(caller_id or not util.is_container())) else 0
|
and (caller_id or not util.is_container())) else 0
|
||||||
if caller_id:
|
if caller_id:
|
||||||
self['cd5'] = caller_id.lower()
|
self['cd5'] = caller_id.lower()
|
||||||
|
|
||||||
|
@ -200,8 +200,8 @@ def get_project_optional_dir(name, default=None):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
config = load_project_config()
|
config = load_project_config()
|
||||||
if (config.has_section("platformio") and
|
if (config.has_section("platformio")
|
||||||
config.has_option("platformio", name)):
|
and config.has_option("platformio", name)):
|
||||||
data = config.get("platformio", name)
|
data = config.get("platformio", name)
|
||||||
except exception.NotPlatformIOProject:
|
except exception.NotPlatformIOProject:
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user