forked from platformio/platformio-core
Better support for file contents writing // Issue #2796
This commit is contained in:
@@ -149,8 +149,7 @@ def cli(
|
||||
|
||||
component_stats = collect_component_stats(results)
|
||||
if json_output:
|
||||
click.echo(dump_json_to_unicode(
|
||||
results_to_json(results, component_stats)))
|
||||
click.echo(dump_json_to_unicode(results_to_json(results, component_stats)))
|
||||
elif not silent:
|
||||
print_check_summary(results, component_stats)
|
||||
|
||||
@@ -167,7 +166,7 @@ def results_to_json(raw, components):
|
||||
"ignored": item.get("succeeded") is None,
|
||||
"succeeded": bool(item.get("succeeded")),
|
||||
"defects": [d.to_json() for d in item.get("defects", [])],
|
||||
"stats": [{k: v} for k, v in components.items()]
|
||||
"stats": [{k: v} for k, v in components.items()],
|
||||
}
|
||||
)
|
||||
results.append(item)
|
||||
|
||||
@@ -145,9 +145,9 @@ def init_base_project(project_dir):
|
||||
|
||||
|
||||
def init_include_readme(include_dir):
|
||||
with open(join(include_dir, "README"), "w") as f:
|
||||
f.write(
|
||||
"""
|
||||
fs.write_file_contents(
|
||||
join(include_dir, "README"),
|
||||
"""
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
@@ -186,15 +186,15 @@ Read more about using header files in official GCC documentation:
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
"""
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
def init_lib_readme(lib_dir):
|
||||
with open(join(lib_dir, "README"), "w") as f:
|
||||
# pylint: disable=line-too-long
|
||||
f.write(
|
||||
"""
|
||||
# pylint: disable=line-too-long
|
||||
fs.write_file_contents(
|
||||
join(lib_dir, "README"),
|
||||
"""
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
@@ -240,14 +240,14 @@ libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
"""
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
def init_test_readme(test_dir):
|
||||
with open(join(test_dir, "README"), "w") as f:
|
||||
f.write(
|
||||
"""
|
||||
fs.write_file_contents(
|
||||
join(test_dir, "README"),
|
||||
"""
|
||||
This directory is intended for PIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
@@ -258,17 +258,17 @@ in the development cycle.
|
||||
|
||||
More information about PIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
||||
"""
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
def init_ci_conf(project_dir):
|
||||
conf_path = join(project_dir, ".travis.yml")
|
||||
if isfile(conf_path):
|
||||
return
|
||||
with open(conf_path, "w") as f:
|
||||
f.write(
|
||||
"""# Continuous Integration (CI) is the practice, in software
|
||||
fs.write_file_contents(
|
||||
conf_path,
|
||||
"""# Continuous Integration (CI) is the practice, in software
|
||||
# engineering, of merging all developer working copies with a shared mainline
|
||||
# several times a day < https://docs.platformio.org/page/ci/index.html >
|
||||
#
|
||||
@@ -335,16 +335,15 @@ def init_ci_conf(project_dir):
|
||||
#
|
||||
# script:
|
||||
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
|
||||
"""
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
def init_cvs_ignore(project_dir):
|
||||
conf_path = join(project_dir, ".gitignore")
|
||||
if isfile(conf_path):
|
||||
return
|
||||
with open(conf_path, "w") as fp:
|
||||
fp.write(".pio\n")
|
||||
fs.write_file_contents(conf_path, ".pio\n")
|
||||
|
||||
|
||||
def fill_project_envs(
|
||||
|
||||
@@ -23,7 +23,6 @@ import click
|
||||
|
||||
from platformio import exception, fs
|
||||
from platformio.commands.device import device_monitor as cmd_device_monitor
|
||||
from platformio.compat import get_file_contents
|
||||
from platformio.managers.core import pioplus_call
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
@@ -201,7 +200,7 @@ def device_monitor(ctx, **kwargs):
|
||||
sleep(0.1)
|
||||
if not t.is_alive():
|
||||
return
|
||||
kwargs["port"] = get_file_contents(sock_file)
|
||||
kwargs["port"] = fs.get_file_contents(sock_file)
|
||||
ctx.invoke(cmd_device_monitor, **kwargs)
|
||||
t.join(2)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user