forked from platformio/platformio-core
Apply YAPF
This commit is contained in:
@ -64,7 +64,8 @@ DEFAULT_SETTINGS = {
|
|||||||
"description":
|
"description":
|
||||||
("Telemetry service <http://docs.platformio.org/page/"
|
("Telemetry service <http://docs.platformio.org/page/"
|
||||||
"userguide/cmd_settings.html?#enable-telemetry> (Yes/No)"),
|
"userguide/cmd_settings.html?#enable-telemetry> (Yes/No)"),
|
||||||
"value": True
|
"value":
|
||||||
|
True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +334,8 @@ def set_session_var(name, value):
|
|||||||
|
|
||||||
def is_disabled_progressbar():
|
def is_disabled_progressbar():
|
||||||
return any([
|
return any([
|
||||||
get_session_var("force_option"), util.is_ci(),
|
get_session_var("force_option"),
|
||||||
|
util.is_ci(),
|
||||||
getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true"
|
getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -89,7 +89,8 @@ DEFAULT_ENV_OPTIONS = dict(
|
|||||||
BUILDSRC_DIR=join("$BUILD_DIR", "src"),
|
BUILDSRC_DIR=join("$BUILD_DIR", "src"),
|
||||||
BUILDTEST_DIR=join("$BUILD_DIR", "test"),
|
BUILDTEST_DIR=join("$BUILD_DIR", "test"),
|
||||||
LIBSOURCE_DIRS=[
|
LIBSOURCE_DIRS=[
|
||||||
util.get_projectlib_dir(), util.get_projectlibdeps_dir(),
|
util.get_projectlib_dir(),
|
||||||
|
util.get_projectlibdeps_dir(),
|
||||||
join("$PIOHOME_DIR", "lib")
|
join("$PIOHOME_DIR", "lib")
|
||||||
],
|
],
|
||||||
PROGNAME="program",
|
PROGNAME="program",
|
||||||
|
@ -74,17 +74,22 @@ def DumpIDEData(env):
|
|||||||
data = {
|
data = {
|
||||||
"libsource_dirs":
|
"libsource_dirs":
|
||||||
[env.subst(l) for l in env.get("LIBSOURCE_DIRS", [])],
|
[env.subst(l) for l in env.get("LIBSOURCE_DIRS", [])],
|
||||||
"defines": dump_defines(env),
|
"defines":
|
||||||
"includes": dump_includes(env),
|
dump_defines(env),
|
||||||
"cc_flags": env.subst(LINTCCOM),
|
"includes":
|
||||||
"cxx_flags": env.subst(LINTCXXCOM),
|
dump_includes(env),
|
||||||
"cc_path": util.where_is_program(
|
"cc_flags":
|
||||||
env.subst("$CC"), env.subst("${ENV['PATH']}")),
|
env.subst(LINTCCOM),
|
||||||
"cxx_path": util.where_is_program(
|
"cxx_flags":
|
||||||
env.subst("$CXX"), env.subst("${ENV['PATH']}")),
|
env.subst(LINTCXXCOM),
|
||||||
"gdb_path": util.where_is_program(
|
"cc_path":
|
||||||
env.subst("$GDB"), env.subst("${ENV['PATH']}")),
|
util.where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
|
||||||
"prog_path": env.subst("$PROG_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()
|
env_ = env.Clone()
|
||||||
|
@ -39,8 +39,8 @@ class LibBuilderFactory(object):
|
|||||||
clsname = "PlatformIOLibBuilder"
|
clsname = "PlatformIOLibBuilder"
|
||||||
else:
|
else:
|
||||||
used_frameworks = LibBuilderFactory.get_used_frameworks(env, path)
|
used_frameworks = LibBuilderFactory.get_used_frameworks(env, path)
|
||||||
common_frameworks = (set(env.get("PIOFRAMEWORK", [])) &
|
common_frameworks = (
|
||||||
set(used_frameworks))
|
set(env.get("PIOFRAMEWORK", [])) & set(used_frameworks))
|
||||||
if common_frameworks:
|
if common_frameworks:
|
||||||
clsname = "%sLibBuilder" % list(common_frameworks)[0].title()
|
clsname = "%sLibBuilder" % list(common_frameworks)[0].title()
|
||||||
elif used_frameworks:
|
elif used_frameworks:
|
||||||
@ -134,8 +134,10 @@ class LibBuilderBase(object):
|
|||||||
@property
|
@property
|
||||||
def src_filter(self):
|
def src_filter(self):
|
||||||
return piotool.SRC_FILTER_DEFAULT + [
|
return piotool.SRC_FILTER_DEFAULT + [
|
||||||
"-<example%s>" % os.sep, "-<examples%s>" % os.sep, "-<test%s>" %
|
"-<example%s>" % os.sep,
|
||||||
os.sep, "-<tests%s>" % os.sep
|
"-<examples%s>" % os.sep,
|
||||||
|
"-<test%s>" % os.sep,
|
||||||
|
"-<tests%s>" % os.sep
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -247,8 +249,9 @@ class LibBuilderBase(object):
|
|||||||
if (key in item and
|
if (key in item and
|
||||||
not self.items_in_list(self.env[env_key], item[key])):
|
not self.items_in_list(self.env[env_key], item[key])):
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
sys.stderr.write("Skip %s incompatible dependency %s\n"
|
sys.stderr.write(
|
||||||
% (key[:-1], item))
|
"Skip %s incompatible dependency %s\n" % (key[:-1],
|
||||||
|
item))
|
||||||
skip = True
|
skip = True
|
||||||
if skip:
|
if skip:
|
||||||
continue
|
continue
|
||||||
@ -337,8 +340,8 @@ class LibBuilderBase(object):
|
|||||||
if _already_depends(lb):
|
if _already_depends(lb):
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
sys.stderr.write("Warning! Circular dependencies detected "
|
sys.stderr.write("Warning! Circular dependencies detected "
|
||||||
"between `%s` and `%s`\n" %
|
"between `%s` and `%s`\n" % (self.path,
|
||||||
(self.path, lb.path))
|
lb.path))
|
||||||
self._circular_deps.append(lb)
|
self._circular_deps.append(lb)
|
||||||
elif lb not in self._depbuilders:
|
elif lb not in self._depbuilders:
|
||||||
self._depbuilders.append(lb)
|
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(
|
if compat_mode > 1 and not lb.is_platforms_compatible(
|
||||||
env['PIOPLATFORM']):
|
env['PIOPLATFORM']):
|
||||||
if verbose:
|
if verbose:
|
||||||
sys.stderr.write("Platform incompatible library %s\n" %
|
sys.stderr.write(
|
||||||
lb.path)
|
"Platform incompatible library %s\n" % lb.path)
|
||||||
return False
|
return False
|
||||||
if compat_mode > 0 and "PIOFRAMEWORK" in env and \
|
if compat_mode > 0 and "PIOFRAMEWORK" in env and \
|
||||||
not lb.is_frameworks_compatible(env.get("PIOFRAMEWORK", [])):
|
not lb.is_frameworks_compatible(env.get("PIOFRAMEWORK", [])):
|
||||||
if verbose:
|
if verbose:
|
||||||
sys.stderr.write("Framework incompatible library %s\n" %
|
sys.stderr.write(
|
||||||
lb.path)
|
"Framework incompatible library %s\n" % lb.path)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ class InoToCPPConverter(object):
|
|||||||
self.env.Execute(
|
self.env.Execute(
|
||||||
self.env.VerboseAction(
|
self.env.VerboseAction(
|
||||||
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(
|
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(
|
||||||
out_file, tmp_path), "Converting " + basename(
|
out_file,
|
||||||
out_file[:-4])))
|
tmp_path), "Converting " + basename(out_file[:-4])))
|
||||||
atexit.register(_delete_file, tmp_path)
|
atexit.register(_delete_file, tmp_path)
|
||||||
return isfile(out_file)
|
return isfile(out_file)
|
||||||
|
|
||||||
@ -139,8 +139,8 @@ class InoToCPPConverter(object):
|
|||||||
prototypes = []
|
prototypes = []
|
||||||
reserved_keywords = set(["if", "else", "while"])
|
reserved_keywords = set(["if", "else", "while"])
|
||||||
for match in self.PROTOTYPE_RE.finditer(contents):
|
for match in self.PROTOTYPE_RE.finditer(contents):
|
||||||
if (set([match.group(2).strip(), match.group(3).strip()]) &
|
if (set([match.group(2).strip(),
|
||||||
reserved_keywords):
|
match.group(3).strip()]) & reserved_keywords):
|
||||||
continue
|
continue
|
||||||
prototypes.append(match)
|
prototypes.append(match)
|
||||||
return prototypes
|
return prototypes
|
||||||
|
@ -81,7 +81,8 @@ 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 or
|
||||||
not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])):
|
not any([k.startswith("BOARD_"),
|
||||||
|
k.startswith("UPLOAD_")])):
|
||||||
continue
|
continue
|
||||||
_opt, _val = k.lower().split("_", 1)
|
_opt, _val = k.lower().split("_", 1)
|
||||||
if _opt == "board":
|
if _opt == "board":
|
||||||
|
@ -107,8 +107,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
|||||||
def _look_for_mbed_disk():
|
def _look_for_mbed_disk():
|
||||||
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
||||||
for item in util.get_logicaldisks():
|
for item in util.get_logicaldisks():
|
||||||
if item['disk'].startswith("/net") or not _is_match_pattern(
|
if item['disk'].startswith(
|
||||||
item['disk']):
|
"/net") or not _is_match_pattern(item['disk']):
|
||||||
continue
|
continue
|
||||||
mbed_pages = [
|
mbed_pages = [
|
||||||
join(item['disk'], n) for n in ("mbed.htm", "mbed.html")
|
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:
|
if used_size > max_size:
|
||||||
sys.stderr.write("Error: The program size (%d bytes) is greater "
|
sys.stderr.write("Error: The program size (%d bytes) is greater "
|
||||||
"than maximum allowed (%s bytes)\n" %
|
"than maximum allowed (%s bytes)\n" % (used_size,
|
||||||
(used_size, max_size))
|
max_size))
|
||||||
env.Exit(1)
|
env.Exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,9 +35,10 @@ SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-<svn%s>" % sep]
|
|||||||
def BuildProgram(env):
|
def BuildProgram(env):
|
||||||
|
|
||||||
def _append_pio_macros():
|
def _append_pio_macros():
|
||||||
env.AppendUnique(CPPDEFINES=[(
|
env.AppendUnique(CPPDEFINES=[
|
||||||
"PLATFORMIO",
|
("PLATFORMIO",
|
||||||
int("{0:02d}{1:02d}{2:02d}".format(*pioversion_to_intstr())))])
|
int("{0:02d}{1:02d}{2:02d}".format(*pioversion_to_intstr())))
|
||||||
|
])
|
||||||
|
|
||||||
_append_pio_macros()
|
_append_pio_macros()
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ def cli(
|
|||||||
click.style(project_dir, fg="cyan"))
|
click.style(project_dir, fg="cyan"))
|
||||||
click.echo("%s - Project Configuration File" % click.style(
|
click.echo("%s - Project Configuration File" % click.style(
|
||||||
"platformio.ini", fg="cyan"))
|
"platformio.ini", fg="cyan"))
|
||||||
click.echo("%s - Put your source files here" % click.style(
|
click.echo(
|
||||||
"src", fg="cyan"))
|
"%s - Put your source files here" % click.style("src", fg="cyan"))
|
||||||
click.echo("%s - Put here project specific (private) libraries" %
|
click.echo("%s - Put here project specific (private) libraries" %
|
||||||
click.style("lib", fg="cyan"))
|
click.style("lib", fg="cyan"))
|
||||||
|
|
||||||
@ -297,7 +297,8 @@ def fill_project_envs(ctx, project_dir, board_ids, project_option, env_prefix,
|
|||||||
config = util.load_project_config(project_dir)
|
config = util.load_project_config(project_dir)
|
||||||
for section in config.sections():
|
for section in config.sections():
|
||||||
cond = [
|
cond = [
|
||||||
section.startswith("env:"), config.has_option(section, "board")
|
section.startswith("env:"),
|
||||||
|
config.has_option(section, "board")
|
||||||
]
|
]
|
||||||
if all(cond):
|
if all(cond):
|
||||||
used_boards.append(config.get(section, "board"))
|
used_boards.append(config.get(section, "board"))
|
||||||
|
@ -366,8 +366,9 @@ def lib_show(library, json_output):
|
|||||||
for v in lib['versions']
|
for v in lib['versions']
|
||||||
]))
|
]))
|
||||||
blocks.append(("Unique Downloads", [
|
blocks.append(("Unique Downloads", [
|
||||||
"Today: %s" % lib['dlstats']['day'], "Week: %s" %
|
"Today: %s" % lib['dlstats']['day'],
|
||||||
lib['dlstats']['week'], "Month: %s" % lib['dlstats']['month']
|
"Week: %s" % lib['dlstats']['week'],
|
||||||
|
"Month: %s" % lib['dlstats']['month']
|
||||||
]))
|
]))
|
||||||
|
|
||||||
for (title, rows) in blocks:
|
for (title, rows) in blocks:
|
||||||
@ -418,16 +419,16 @@ def lib_stats(json_output):
|
|||||||
click.echo("-" * terminal_width)
|
click.echo("-" * terminal_width)
|
||||||
|
|
||||||
def _print_lib_item(item):
|
def _print_lib_item(item):
|
||||||
click.echo((
|
click.echo((printitemdate_tpl
|
||||||
printitemdate_tpl if "date" in item else printitem_tpl
|
if "date" in item else printitem_tpl).format(
|
||||||
).format(
|
name=click.style(item['name'], fg="cyan"),
|
||||||
name=click.style(item['name'], fg="cyan"),
|
date=str(
|
||||||
date=str(
|
arrow.get(item['date']).humanize()
|
||||||
arrow.get(item['date']).humanize() if "date" in item else ""),
|
if "date" in item else ""),
|
||||||
url=click.style(
|
url=click.style(
|
||||||
"http://platformio.org/lib/show/%s/%s" % (item['id'],
|
"http://platformio.org/lib/show/%s/%s" %
|
||||||
quote(item['name'])),
|
(item['id'], quote(item['name'])),
|
||||||
fg="blue")))
|
fg="blue")))
|
||||||
|
|
||||||
def _print_tag_item(name):
|
def _print_tag_item(name):
|
||||||
click.echo(
|
click.echo(
|
||||||
@ -457,8 +458,8 @@ def lib_stats(json_output):
|
|||||||
_print_tag_item(item)
|
_print_tag_item(item)
|
||||||
click.echo()
|
click.echo()
|
||||||
|
|
||||||
for key, title in (("dlday", "Today"), ("dlweek", "Week"),
|
for key, title in (("dlday", "Today"), ("dlweek", "Week"), ("dlmonth",
|
||||||
("dlmonth", "Month")):
|
"Month")):
|
||||||
_print_title("Featured: " + title)
|
_print_title("Featured: " + title)
|
||||||
_print_header(with_date=False)
|
_print_header(with_date=False)
|
||||||
for item in result.get(key, []):
|
for item in result.get(key, []):
|
||||||
|
@ -269,8 +269,8 @@ def platform_show(platform, json_output): # pylint: disable=too-many-branches
|
|||||||
if item['type']:
|
if item['type']:
|
||||||
click.echo("Type: %s" % item['type'])
|
click.echo("Type: %s" % item['type'])
|
||||||
click.echo("Requirements: %s" % item['requirements'])
|
click.echo("Requirements: %s" % item['requirements'])
|
||||||
click.echo("Installed: %s" % ("Yes" if item.get("version") else
|
click.echo("Installed: %s" %
|
||||||
"No (optional)"))
|
("Yes" if item.get("version") else "No (optional)"))
|
||||||
if "version" in item:
|
if "version" in item:
|
||||||
click.echo("Version: %s" % item['version'])
|
click.echo("Version: %s" % item['version'])
|
||||||
if "originalVersion" in item:
|
if "originalVersion" in item:
|
||||||
|
@ -169,11 +169,12 @@ class EnvironmentProcessor(object):
|
|||||||
|
|
||||||
if not self.silent:
|
if not self.silent:
|
||||||
click.echo("[%s] Processing %s (%s)" %
|
click.echo("[%s] Processing %s (%s)" %
|
||||||
(datetime.now().strftime("%c"), click.style(
|
(datetime.now().strftime("%c"),
|
||||||
self.name, fg="cyan", bold=True), "; ".join([
|
click.style(self.name, fg="cyan", bold=True),
|
||||||
"%s: %s" % (k, v.replace("\n", ", "))
|
"; ".join([
|
||||||
for k, v in self.options.items()
|
"%s: %s" % (k, v.replace("\n", ", "))
|
||||||
])))
|
for k, v in self.options.items()
|
||||||
|
])))
|
||||||
click.secho("-" * terminal_width, bold=True)
|
click.secho("-" * terminal_width, bold=True)
|
||||||
|
|
||||||
self.options = self._validate_options(self.options)
|
self.options = self._validate_options(self.options)
|
||||||
@ -185,10 +186,10 @@ class EnvironmentProcessor(object):
|
|||||||
|
|
||||||
if is_error or "piotest_processor" not in self.cmd_ctx.meta:
|
if is_error or "piotest_processor" not in self.cmd_ctx.meta:
|
||||||
print_header(
|
print_header(
|
||||||
"[%s] Took %.2f seconds" % ((click.style(
|
"[%s] Took %.2f seconds" %
|
||||||
"ERROR", fg="red", bold=True) if is_error else click.style(
|
((click.style("ERROR", fg="red", bold=True)
|
||||||
"SUCCESS", fg="green", bold=True)),
|
if is_error else click.style(
|
||||||
time() - start_time),
|
"SUCCESS", fg="green", bold=True)), time() - start_time),
|
||||||
is_error=is_error)
|
is_error=is_error)
|
||||||
|
|
||||||
return not is_error
|
return not is_error
|
||||||
@ -356,9 +357,10 @@ def print_summary(results, start_time):
|
|||||||
err=status is False)
|
err=status is False)
|
||||||
|
|
||||||
print_header(
|
print_header(
|
||||||
"[%s] Took %.2f seconds" % ((click.style(
|
"[%s] Took %.2f seconds" %
|
||||||
"SUCCESS", fg="green", bold=True) if successed else click.style(
|
((click.style("SUCCESS", fg="green", bold=True)
|
||||||
"ERROR", fg="red", bold=True)), time() - start_time),
|
if successed else click.style("ERROR", fg="red", bold=True)),
|
||||||
|
time() - start_time),
|
||||||
is_error=not successed)
|
is_error=not successed)
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,8 +38,9 @@ class FileDownloader(object):
|
|||||||
|
|
||||||
disposition = self._request.headers.get("content-disposition")
|
disposition = self._request.headers.get("content-disposition")
|
||||||
if disposition and "filename=" in disposition:
|
if disposition and "filename=" in disposition:
|
||||||
self._fname = disposition[disposition.index("filename=") +
|
self._fname = disposition[
|
||||||
9:].replace('"', "").replace("'", "")
|
disposition.index("filename=") + 9:].replace('"', "").replace(
|
||||||
|
"'", "")
|
||||||
self._fname = self._fname.encode("utf8")
|
self._fname = self._fname.encode("utf8")
|
||||||
else:
|
else:
|
||||||
self._fname = url.split("/")[-1]
|
self._fname = url.split("/")[-1]
|
||||||
|
@ -151,16 +151,24 @@ class ProjectGenerator(object):
|
|||||||
self._tplvars.update(self.get_project_env())
|
self._tplvars.update(self.get_project_env())
|
||||||
self._tplvars.update(self.get_project_build_data())
|
self._tplvars.update(self.get_project_build_data())
|
||||||
self._tplvars.update({
|
self._tplvars.update({
|
||||||
"project_name": self.get_project_name(),
|
"project_name":
|
||||||
"src_files": self.get_src_files(),
|
self.get_project_name(),
|
||||||
"user_home_dir": abspath(expanduser("~")),
|
"src_files":
|
||||||
"project_dir": self.project_dir,
|
self.get_src_files(),
|
||||||
"project_src_dir": self.project_src_dir,
|
"user_home_dir":
|
||||||
"systype": util.get_systype(),
|
abspath(expanduser("~")),
|
||||||
|
"project_dir":
|
||||||
|
self.project_dir,
|
||||||
|
"project_src_dir":
|
||||||
|
self.project_src_dir,
|
||||||
|
"systype":
|
||||||
|
util.get_systype(),
|
||||||
"platformio_path":
|
"platformio_path":
|
||||||
self._fix_os_path(util.where_is_program("platformio")),
|
self._fix_os_path(util.where_is_program("platformio")),
|
||||||
"env_pathsep": os.pathsep,
|
"env_pathsep":
|
||||||
"env_path": self._fix_os_path(os.getenv("PATH"))
|
os.pathsep,
|
||||||
|
"env_path":
|
||||||
|
self._fix_os_path(os.getenv("PATH"))
|
||||||
})
|
})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -95,12 +95,12 @@ class Upgrader(object):
|
|||||||
self.to_version = semantic_version.Version.coerce(
|
self.to_version = semantic_version.Version.coerce(
|
||||||
util.pepver_to_semver(to_version))
|
util.pepver_to_semver(to_version))
|
||||||
|
|
||||||
self._upgraders = [
|
self._upgraders = [(semantic_version.Version("3.0.0-a.1"),
|
||||||
(semantic_version.Version("3.0.0-a.1"), self._upgrade_to_3_0_0),
|
self._upgrade_to_3_0_0),
|
||||||
(semantic_version.Version("3.0.0-b.11"),
|
(semantic_version.Version("3.0.0-b.11"),
|
||||||
self._upgrade_to_3_0_0b11),
|
self._upgrade_to_3_0_0b11),
|
||||||
(semantic_version.Version("3.4.0-a.9"), self._update_dev_platforms)
|
(semantic_version.Version("3.4.0-a.9"),
|
||||||
]
|
self._update_dev_platforms)]
|
||||||
|
|
||||||
def run(self, ctx):
|
def run(self, ctx):
|
||||||
if self.from_version > self.to_version:
|
if self.from_version > self.to_version:
|
||||||
@ -170,8 +170,8 @@ def after_upgrade(ctx):
|
|||||||
util.pepver_to_semver(__version__)):
|
util.pepver_to_semver(__version__)):
|
||||||
click.secho("*" * terminal_width, fg="yellow")
|
click.secho("*" * terminal_width, fg="yellow")
|
||||||
click.secho(
|
click.secho(
|
||||||
"Obsolete PIO Core v%s is used (previous was %s)" %
|
"Obsolete PIO Core v%s is used (previous was %s)" % (__version__,
|
||||||
(__version__, last_version),
|
last_version),
|
||||||
fg="yellow")
|
fg="yellow")
|
||||||
click.secho(
|
click.secho(
|
||||||
"Please remove multiple PIO Cores from a system:", fg="yellow")
|
"Please remove multiple PIO Cores from a system:", fg="yellow")
|
||||||
@ -205,23 +205,25 @@ def after_upgrade(ctx):
|
|||||||
|
|
||||||
# PlatformIO banner
|
# PlatformIO banner
|
||||||
click.echo("*" * terminal_width)
|
click.echo("*" * terminal_width)
|
||||||
click.echo("If you like %s, please:" % (click.style(
|
click.echo("If you like %s, please:" %
|
||||||
"PlatformIO", fg="cyan")))
|
(click.style("PlatformIO", fg="cyan")))
|
||||||
click.echo("- %s us on Twitter to stay up-to-date "
|
click.echo("- %s us on Twitter to stay up-to-date "
|
||||||
"on the latest project news > %s" % (click.style(
|
"on the latest project news > %s" %
|
||||||
"follow", fg="cyan"), click.style(
|
(click.style("follow", fg="cyan"),
|
||||||
"https://twitter.com/PlatformIO_Org", fg="cyan")))
|
click.style("https://twitter.com/PlatformIO_Org", fg="cyan")))
|
||||||
click.echo("- %s it on GitHub > %s" %
|
click.echo(
|
||||||
(click.style("star", fg="cyan"), click.style(
|
"- %s it on GitHub > %s" %
|
||||||
"https://github.com/platformio/platformio", fg="cyan")))
|
(click.style("star", fg="cyan"),
|
||||||
|
click.style("https://github.com/platformio/platformio", fg="cyan")))
|
||||||
if not getenv("PLATFORMIO_IDE"):
|
if not getenv("PLATFORMIO_IDE"):
|
||||||
click.echo("- %s PlatformIO IDE for IoT development > %s" %
|
click.echo(
|
||||||
(click.style("try", fg="cyan"), click.style(
|
"- %s PlatformIO IDE for IoT development > %s" %
|
||||||
"http://platformio.org/platformio-ide", fg="cyan")))
|
(click.style("try", fg="cyan"),
|
||||||
|
click.style("http://platformio.org/platformio-ide", fg="cyan")))
|
||||||
if not util.is_ci():
|
if not util.is_ci():
|
||||||
click.echo("- %s us with PlatformIO Plus > %s" % (click.style(
|
click.echo("- %s us with PlatformIO Plus > %s" %
|
||||||
"support", fg="cyan"), click.style(
|
(click.style("support", fg="cyan"),
|
||||||
"https://pioplus.com", fg="cyan")))
|
click.style("https://pioplus.com", fg="cyan")))
|
||||||
|
|
||||||
click.echo("*" * terminal_width)
|
click.echo("*" * terminal_width)
|
||||||
click.echo("")
|
click.echo("")
|
||||||
@ -284,8 +286,8 @@ def check_internal_updates(ctx, what):
|
|||||||
if manifest['name'] in outdated_items:
|
if manifest['name'] in outdated_items:
|
||||||
continue
|
continue
|
||||||
conds = [
|
conds = [
|
||||||
pm.outdated(manifest['__pkg_dir']), what == "platforms" and
|
pm.outdated(manifest['__pkg_dir']),
|
||||||
PlatformFactory.newPlatform(
|
what == "platforms" and PlatformFactory.newPlatform(
|
||||||
manifest['__pkg_dir']).are_outdated_packages()
|
manifest['__pkg_dir']).are_outdated_packages()
|
||||||
]
|
]
|
||||||
if any(conds):
|
if any(conds):
|
||||||
@ -299,8 +301,8 @@ def check_internal_updates(ctx, what):
|
|||||||
click.echo("")
|
click.echo("")
|
||||||
click.echo("*" * terminal_width)
|
click.echo("*" * terminal_width)
|
||||||
click.secho(
|
click.secho(
|
||||||
"There are the new updates for %s (%s)" %
|
"There are the new updates for %s (%s)" % (what,
|
||||||
(what, ", ".join(outdated_items)),
|
", ".join(outdated_items)),
|
||||||
fg="yellow")
|
fg="yellow")
|
||||||
|
|
||||||
if not app.get_setting("auto_update_" + what):
|
if not app.get_setting("auto_update_" + what):
|
||||||
|
@ -226,9 +226,9 @@ class LibraryManager(BasePkgManager):
|
|||||||
cache_valid="30d")
|
cache_valid="30d")
|
||||||
assert dl_data
|
assert dl_data
|
||||||
|
|
||||||
return self._install_from_url(
|
return self._install_from_url(name, dl_data['url'].replace(
|
||||||
name, dl_data['url'].replace("http://", "https://")
|
"http://", "https://") if app.get_setting("enable_ssl") else
|
||||||
if app.get_setting("enable_ssl") else dl_data['url'], requirements)
|
dl_data['url'], requirements)
|
||||||
|
|
||||||
def install( # pylint: disable=arguments-differ
|
def install( # pylint: disable=arguments-differ
|
||||||
self,
|
self,
|
||||||
@ -239,8 +239,8 @@ class LibraryManager(BasePkgManager):
|
|||||||
interactive=False):
|
interactive=False):
|
||||||
pkg_dir = None
|
pkg_dir = None
|
||||||
try:
|
try:
|
||||||
_name, _requirements, _url = self.parse_pkg_input(name,
|
_name, _requirements, _url = self.parse_pkg_input(
|
||||||
requirements)
|
name, requirements)
|
||||||
if not _url:
|
if not _url:
|
||||||
name = "id=%d" % self.get_pkg_id_by_name(
|
name = "id=%d" % self.get_pkg_id_by_name(
|
||||||
_name,
|
_name,
|
||||||
@ -309,8 +309,9 @@ class LibraryManager(BasePkgManager):
|
|||||||
if not isinstance(values, list):
|
if not isinstance(values, list):
|
||||||
values = [v.strip() for v in values.split(",") if v]
|
values = [v.strip() for v in values.split(",") if v]
|
||||||
for value in values:
|
for value in values:
|
||||||
query.append('%s:"%s"' % (key[:-1] if key.endswith("s") else
|
query.append('%s:"%s"' % (key[:-1]
|
||||||
key, value))
|
if key.endswith("s") else key,
|
||||||
|
value))
|
||||||
|
|
||||||
lib_info = None
|
lib_info = None
|
||||||
result = util.get_api_result(
|
result = util.get_api_result(
|
||||||
|
@ -418,8 +418,8 @@ class PkgInstallerMixin(object):
|
|||||||
# package should satisfy requirements
|
# package should satisfy requirements
|
||||||
if requirements:
|
if requirements:
|
||||||
mismatch_error = (
|
mismatch_error = (
|
||||||
"Package version %s doesn't satisfy requirements %s" % (
|
"Package version %s doesn't satisfy requirements %s" %
|
||||||
tmp_manifest['version'], requirements))
|
(tmp_manifest['version'], requirements))
|
||||||
try:
|
try:
|
||||||
assert tmp_semver and tmp_semver in semantic_version.Spec(
|
assert tmp_semver and tmp_semver in semantic_version.Spec(
|
||||||
requirements), mismatch_error
|
requirements), mismatch_error
|
||||||
@ -651,18 +651,18 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
|||||||
if isdir(package):
|
if isdir(package):
|
||||||
pkg_dir = package
|
pkg_dir = package
|
||||||
else:
|
else:
|
||||||
name, requirements, url = self.parse_pkg_input(package,
|
name, requirements, url = self.parse_pkg_input(
|
||||||
requirements)
|
package, requirements)
|
||||||
pkg_dir = self.get_package_dir(name, requirements, url)
|
pkg_dir = self.get_package_dir(name, requirements, url)
|
||||||
|
|
||||||
if not pkg_dir:
|
if not pkg_dir:
|
||||||
raise exception.UnknownPackage("%s @ %s" %
|
raise exception.UnknownPackage("%s @ %s" % (package,
|
||||||
(package, requirements or "*"))
|
requirements or "*"))
|
||||||
|
|
||||||
manifest = self.load_manifest(pkg_dir)
|
manifest = self.load_manifest(pkg_dir)
|
||||||
click.echo(
|
click.echo(
|
||||||
"Uninstalling %s @ %s: \t" % (click.style(
|
"Uninstalling %s @ %s: \t" %
|
||||||
manifest['name'], fg="cyan"), manifest['version']),
|
(click.style(manifest['name'], fg="cyan"), manifest['version']),
|
||||||
nl=False)
|
nl=False)
|
||||||
|
|
||||||
if islink(pkg_dir):
|
if islink(pkg_dir):
|
||||||
@ -674,9 +674,9 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
|||||||
# unfix package with the same name
|
# unfix package with the same name
|
||||||
pkg_dir = self.get_package_dir(manifest['name'])
|
pkg_dir = self.get_package_dir(manifest['name'])
|
||||||
if pkg_dir and "@" in pkg_dir:
|
if pkg_dir and "@" in pkg_dir:
|
||||||
os.rename(
|
os.rename(pkg_dir,
|
||||||
pkg_dir,
|
join(self.package_dir,
|
||||||
join(self.package_dir, self.get_install_dirname(manifest)))
|
self.get_install_dirname(manifest)))
|
||||||
self.cache_reset()
|
self.cache_reset()
|
||||||
|
|
||||||
click.echo("[%s]" % click.style("OK", fg="green"))
|
click.echo("[%s]" % click.style("OK", fg="green"))
|
||||||
@ -699,8 +699,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
|||||||
pkg_dir = self.get_package_dir(*self.parse_pkg_input(package))
|
pkg_dir = self.get_package_dir(*self.parse_pkg_input(package))
|
||||||
|
|
||||||
if not pkg_dir:
|
if not pkg_dir:
|
||||||
raise exception.UnknownPackage("%s @ %s" %
|
raise exception.UnknownPackage("%s @ %s" % (package,
|
||||||
(package, requirements or "*"))
|
requirements or "*"))
|
||||||
|
|
||||||
manifest = self.load_manifest(pkg_dir)
|
manifest = self.load_manifest(pkg_dir)
|
||||||
name = manifest['name']
|
name = manifest['name']
|
||||||
|
@ -84,8 +84,8 @@ class PlatformManager(BasePkgManager):
|
|||||||
if isdir(package):
|
if isdir(package):
|
||||||
pkg_dir = package
|
pkg_dir = package
|
||||||
else:
|
else:
|
||||||
name, requirements, url = self.parse_pkg_input(package,
|
name, requirements, url = self.parse_pkg_input(
|
||||||
requirements)
|
package, requirements)
|
||||||
pkg_dir = self.get_package_dir(name, requirements, url)
|
pkg_dir = self.get_package_dir(name, requirements, url)
|
||||||
|
|
||||||
p = PlatformFactory.newPlatform(pkg_dir)
|
p = PlatformFactory.newPlatform(pkg_dir)
|
||||||
@ -108,8 +108,8 @@ class PlatformManager(BasePkgManager):
|
|||||||
if isdir(package):
|
if isdir(package):
|
||||||
pkg_dir = package
|
pkg_dir = package
|
||||||
else:
|
else:
|
||||||
name, requirements, url = self.parse_pkg_input(package,
|
name, requirements, url = self.parse_pkg_input(
|
||||||
requirements)
|
package, requirements)
|
||||||
pkg_dir = self.get_package_dir(name, requirements, url)
|
pkg_dir = self.get_package_dir(name, requirements, url)
|
||||||
|
|
||||||
p = PlatformFactory.newPlatform(pkg_dir)
|
p = PlatformFactory.newPlatform(pkg_dir)
|
||||||
@ -207,8 +207,8 @@ class PlatformFactory(object):
|
|||||||
else:
|
else:
|
||||||
if not requirements and "@" in name:
|
if not requirements and "@" in name:
|
||||||
name, requirements = name.rsplit("@", 1)
|
name, requirements = name.rsplit("@", 1)
|
||||||
platform_dir = PlatformManager().get_package_dir(name,
|
platform_dir = PlatformManager().get_package_dir(
|
||||||
requirements)
|
name, requirements)
|
||||||
|
|
||||||
if not platform_dir:
|
if not platform_dir:
|
||||||
raise exception.UnknownPlatform(name if not requirements else
|
raise exception.UnknownPlatform(name if not requirements else
|
||||||
@ -358,7 +358,8 @@ class PlatformRunMixin(object):
|
|||||||
util.get_pythonexe_path(),
|
util.get_pythonexe_path(),
|
||||||
join(get_core_package_dir("tool-scons"), "script", "scons"), "-Q",
|
join(get_core_package_dir("tool-scons"), "script", "scons"), "-Q",
|
||||||
"-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support",
|
"-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support",
|
||||||
"-f", join(util.get_source_dir(), "builder", "main.py")
|
"-f",
|
||||||
|
join(util.get_source_dir(), "builder", "main.py")
|
||||||
]
|
]
|
||||||
cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0))
|
cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0))
|
||||||
cmd += targets
|
cmd += targets
|
||||||
@ -579,8 +580,10 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
|||||||
if not isdir(libcore_dir):
|
if not isdir(libcore_dir):
|
||||||
continue
|
continue
|
||||||
storages.append({
|
storages.append({
|
||||||
"name": "%s-core-%s" % (opts['package'], item),
|
"name":
|
||||||
"path": libcore_dir
|
"%s-core-%s" % (opts['package'], item),
|
||||||
|
"path":
|
||||||
|
libcore_dir
|
||||||
})
|
})
|
||||||
|
|
||||||
return storages
|
return storages
|
||||||
|
@ -255,8 +255,9 @@ def measure_ci():
|
|||||||
"label": getenv("APPVEYOR_REPO_NAME")
|
"label": getenv("APPVEYOR_REPO_NAME")
|
||||||
},
|
},
|
||||||
"CIRCLECI": {
|
"CIRCLECI": {
|
||||||
"label": "%s/%s" % (getenv("CIRCLE_PROJECT_USERNAME"),
|
"label":
|
||||||
getenv("CIRCLE_PROJECT_REPONAME"))
|
"%s/%s" % (getenv("CIRCLE_PROJECT_USERNAME"),
|
||||||
|
getenv("CIRCLE_PROJECT_REPONAME"))
|
||||||
},
|
},
|
||||||
"TRAVIS": {
|
"TRAVIS": {
|
||||||
"label": getenv("TRAVIS_REPO_SLUG")
|
"label": getenv("TRAVIS_REPO_SLUG")
|
||||||
|
@ -174,8 +174,8 @@ def load_json(file_path):
|
|||||||
with open(file_path, "r") as f:
|
with open(file_path, "r") as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise exception.PlatformioException("Could not load broken JSON: %s" %
|
raise exception.PlatformioException(
|
||||||
file_path)
|
"Could not load broken JSON: %s" % file_path)
|
||||||
|
|
||||||
|
|
||||||
def get_systype():
|
def get_systype():
|
||||||
@ -282,8 +282,8 @@ def get_projectsrc_dir():
|
|||||||
|
|
||||||
|
|
||||||
def get_projecttest_dir():
|
def get_projecttest_dir():
|
||||||
return get_project_optional_dir("test_dir",
|
return get_project_optional_dir("test_dir", join(get_project_dir(),
|
||||||
join(get_project_dir(), "test"))
|
"test"))
|
||||||
|
|
||||||
|
|
||||||
def get_projectboards_dir():
|
def get_projectboards_dir():
|
||||||
@ -311,8 +311,8 @@ URL=http://docs.platformio.org/page/projectconf.html#envs-dir
|
|||||||
|
|
||||||
|
|
||||||
def get_projectdata_dir():
|
def get_projectdata_dir():
|
||||||
return get_project_optional_dir("data_dir",
|
return get_project_optional_dir("data_dir", join(get_project_dir(),
|
||||||
join(get_project_dir(), "data"))
|
"data"))
|
||||||
|
|
||||||
|
|
||||||
def load_project_config(path=None):
|
def load_project_config(path=None):
|
||||||
@ -495,8 +495,8 @@ def _get_api_result(
|
|||||||
else:
|
else:
|
||||||
raise exception.APIRequestError(e)
|
raise exception.APIRequestError(e)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise exception.APIRequestError("Invalid response: %s" %
|
raise exception.APIRequestError(
|
||||||
r.text.encode("utf-8"))
|
"Invalid response: %s" % r.text.encode("utf-8"))
|
||||||
finally:
|
finally:
|
||||||
if r:
|
if r:
|
||||||
r.close()
|
r.close()
|
||||||
@ -543,8 +543,8 @@ def internet_on(timeout=3):
|
|||||||
socket.setdefaulttimeout(timeout)
|
socket.setdefaulttimeout(timeout)
|
||||||
for host in ("dl.bintray.com", "dl.platformio.org"):
|
for host in ("dl.bintray.com", "dl.platformio.org"):
|
||||||
try:
|
try:
|
||||||
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(
|
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host,
|
||||||
(host, 80))
|
80))
|
||||||
return True
|
return True
|
||||||
except: # pylint: disable=bare-except
|
except: # pylint: disable=bare-except
|
||||||
pass
|
pass
|
||||||
|
@ -37,8 +37,8 @@ class VCSClientFactory(object):
|
|||||||
if "#" in remote_url:
|
if "#" in remote_url:
|
||||||
remote_url, tag = remote_url.rsplit("#", 1)
|
remote_url, tag = remote_url.rsplit("#", 1)
|
||||||
if not type_:
|
if not type_:
|
||||||
raise PlatformioException("VCS: Unknown repository type %s" %
|
raise PlatformioException(
|
||||||
remote_url)
|
"VCS: Unknown repository type %s" % remote_url)
|
||||||
obj = getattr(modules[__name__], "%sClient" % type_.title())(
|
obj = getattr(modules[__name__], "%sClient" % type_.title())(
|
||||||
src_dir, remote_url, tag, silent)
|
src_dir, remote_url, tag, silent)
|
||||||
assert isinstance(obj, VCSClientBase)
|
assert isinstance(obj, VCSClientBase)
|
||||||
@ -103,8 +103,8 @@ class VCSClientBase(object):
|
|||||||
if result['returncode'] == 0:
|
if result['returncode'] == 0:
|
||||||
return result['out'].strip()
|
return result['out'].strip()
|
||||||
raise PlatformioException(
|
raise PlatformioException(
|
||||||
"VCS: Could not receive an output from `%s` command (%s)" % (
|
"VCS: Could not receive an output from `%s` command (%s)" %
|
||||||
args, result))
|
(args, result))
|
||||||
|
|
||||||
|
|
||||||
class GitClient(VCSClientBase):
|
class GitClient(VCSClientBase):
|
||||||
|
Reference in New Issue
Block a user