diff --git a/platformio/commands/debug/client.py b/platformio/commands/debug/client.py index 2c6d9724..fa468bba 100644 --- a/platformio/commands/debug/client.py +++ b/platformio/commands/debug/client.py @@ -265,7 +265,7 @@ class GDBClient(BaseProcess): # pylint: disable=too-many-instance-attributes telemetry.encode_run_environment(self.env_options), last_erros, ) - telemetry.send_exception("DebugInitError: %s" % err, is_fatal=True) + telemetry.send_exception("DebugInitError: %s" % err) self.transport.loseConnection() def _kill_previous_session(self): diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 6e775099..34eb59f5 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import io +import codecs import os import sys from os.path import basename, isdir, isfile, join, realpath, relpath @@ -129,18 +129,18 @@ class ProjectGenerator(object): dst_dir = join(self.project_dir, tpl_relpath) if not isdir(dst_dir): os.makedirs(dst_dir) - file_name = basename(tpl_path)[:-4] contents = self._render_tpl(tpl_path, tpl_vars) self._merge_contents(join(dst_dir, file_name), contents) @staticmethod def _render_tpl(tpl_path, tpl_vars): - return bottle.template(fs.get_file_contents(tpl_path), **tpl_vars) + with codecs.open(tpl_path, "r", encoding="utf8") as fp: + return bottle.SimpleTemplate(fp.read()).render(**tpl_vars) @staticmethod def _merge_contents(dst_path, contents): if basename(dst_path) == ".gitignore" and isfile(dst_path): return - with io.open(dst_path, "w", encoding="utf8") as fp: + with codecs.open(dst_path, "w", encoding="utf8") as fp: fp.write(contents) diff --git a/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl b/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl index 62dfebad..1b2dfdd9 100644 --- a/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl @@ -5,8 +5,9 @@ % recommendations = set(["platformio.platformio-ide"]) % previous_json = os.path.join(project_dir, ".vscode", "extensions.json") % if os.path.isfile(previous_json): -% with open(previous_json) as fp: -% contents = re.sub(r"^\s*//.*$", "", fp.read(), flags=re.M).strip() +% fp = open(previous_json) +% contents = re.sub(r"^\s*//.*$", "", fp.read(), flags=re.M).strip() +% fp.close() % if contents: % recommendations |= set(json.loads(contents).get("recommendations", [])) % end diff --git a/platformio/telemetry.py b/platformio/telemetry.py index ddb12f60..54bd8c4b 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -78,6 +78,7 @@ class MeasurementProtocol(TelemetryBase): self._prefill_screen_name() self._prefill_appinfo() + self._prefill_sysargs() self._prefill_custom_data() def __getitem__(self, name): @@ -102,6 +103,15 @@ class MeasurementProtocol(TelemetryBase): dpdata.append("IDE/%s" % os.getenv("PLATFORMIO_IDE")) self["an"] = " ".join(dpdata) + def _prefill_sysargs(self): + args = [] + for arg in sys.argv[1:]: + arg = str(arg).lower() + if "@" in arg or os.path.exists(arg): + arg = "***" + args.append(arg) + self["cd3"] = " ".join(args) + def _prefill_custom_data(self): def _filter_args(items): result = [] @@ -118,7 +128,6 @@ class MeasurementProtocol(TelemetryBase): caller_id = str(app.get_session_var("caller_id")) self["cd1"] = util.get_systype() 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 is_container())) else 0 )