Skip to content

Commit 55e434c

Browse files
authored
Add LZMA support check in platform.py
increased timout for RasPi
1 parent f7e8ced commit 55e434c

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

platform.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# LZMA support check
16+
try:
17+
import lzma as _lzma
18+
except ImportError:
19+
import sys
20+
print("ERROR: Python's lzma module is unavailable or broken in this interpreter.", file=sys.stderr)
21+
print("LZMA (liblzma) support is required for tool/toolchain installation.", file=sys.stderr)
22+
print("Please install Python built with LZMA support.", file=sys.stderr)
23+
raise SystemExit(1)
24+
else:
25+
# Keep namespace clean
26+
del _lzma
27+
1528
import fnmatch
1629
import os
1730
import json
@@ -21,14 +34,19 @@
2134
import logging
2235
from typing import Optional, Dict, List, Any
2336

37+
from platformio.compat import IS_WINDOWS
2438
from platformio.public import PlatformBase, to_unix_path
2539
from platformio.proc import get_pythonexe_path
2640
from platformio.project.config import ProjectConfig
2741
from platformio.package.manager.tool import ToolPackageManager
2842

2943
# Constants
44+
try:
45+
with open('/proc/device-tree/model') as f:
46+
SUBPROCESS_TIMEOUT = 900 if 'raspberry pi' in f.read().lower() else 300
47+
except:
48+
SUBPROCESS_TIMEOUT = 300
3049
RETRY_LIMIT = 3
31-
SUBPROCESS_TIMEOUT = 300
3250
DEFAULT_DEBUG_SPEED = "5000"
3351
DEFAULT_APP_OFFSET = "0x10000"
3452
tl_install_name = "tool-esp_install"
@@ -68,7 +86,6 @@
6886
]
6987

7088
# System-specific configuration
71-
IS_WINDOWS = sys.platform.startswith("win")
7289
# Set Platformio env var to use windows_amd64 for all windows architectures
7390
# only windows_amd64 native espressif toolchains are available
7491
if IS_WINDOWS:
@@ -850,7 +867,7 @@ def _get_debug_server_args(self, openocd_interface: str, debug: Dict) -> List[st
850867
return [
851868
"-s", "$PACKAGE_DIR/share/openocd/scripts",
852869
"-f", f"interface/{openocd_interface}.cfg",
853-
"-f", f"{config_type}/{config_name}.cfg"
870+
"-f", f"{config_type}/{config_name}"
854871
]
855872

856873
def configure_debug_session(self, debug_config):

0 commit comments

Comments
 (0)