Skip to content

Commit b1b44fe

Browse files
committed
Add compatibility with PIO Core 6.0
1 parent 609a87f commit b1b44fe

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

monitor/filter_exception_decoder.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@
1717
import subprocess
1818
import sys
1919

20-
from platformio.compat import path_to_unicode, WINDOWS
2120
from platformio.project.exception import PlatformioException
22-
from platformio.project.helpers import load_project_ide_data
23-
from platformio.commands.device import DeviceMonitorFilter
21+
from platformio.public import (
22+
DeviceMonitorFilterBase,
23+
load_build_metadata,
24+
)
2425

2526
# By design, __init__ is called inside miniterm and we can't pass context to it.
2627
# pylint: disable=attribute-defined-outside-init
2728

29+
IS_WINDOWS = sys.platform.startswith("win")
2830

29-
class Esp32ExceptionDecoder(DeviceMonitorFilter):
31+
32+
class Esp32ExceptionDecoder(DeviceMonitorFilterBase):
3033
NAME = "esp32_exception_decoder"
3134

3235
def __call__(self):
@@ -51,9 +54,9 @@ def __call__(self):
5154
return self
5255

5356
def setup_paths(self):
54-
self.project_dir = path_to_unicode(os.path.abspath(self.project_dir))
57+
self.project_dir = os.path.abspath(self.project_dir)
5558
try:
56-
data = load_project_ide_data(self.project_dir, self.environment)
59+
data = load_build_metadata(self.project_dir, self.environment)
5760
self.firmware_path = data["prog_path"]
5861
if not os.path.isfile(self.firmware_path):
5962
sys.stderr.write(
@@ -109,7 +112,7 @@ def rx(self, text):
109112

110113
def get_backtrace(self, match):
111114
trace = ""
112-
enc = "mbcs" if WINDOWS else "utf-8"
115+
enc = "mbcs" if IS_WINDOWS else "utf-8"
113116
args = [self.addr2line_path, u"-fipC", u"-e", self.firmware_path]
114117
try:
115118
for i, addr in enumerate(match.group(1).split()):

0 commit comments

Comments
 (0)