Skip to content

Commit

Permalink
[tools] fix with Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Nov 26, 2024
1 parent 527a9ce commit 419fa4b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 30
container:
image: ghcr.io/modm-ext/modm-build-base:2022-09-27
image: ghcr.io/modm-ext/modm-build-base:2023-03-12
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down
14 changes: 10 additions & 4 deletions repo.lb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,22 @@ import platform
from pathlib import Path
from git import Repo
from os.path import normpath
from importlib.metadata import version

def StrictVersion(v):
return tuple(map(int, (v.split("."))))

# Check for miminum required lbuild version
import lbuild
min_lbuild_version = "1.21.6"
if StrictVersion(getattr(lbuild, "__version__", "0.1.0")) < StrictVersion(min_lbuild_version):
print("modm requires at least lbuild v{}, please upgrade!\n"
" pip3 install -U lbuild".format(min_lbuild_version))
if StrictVersion(version("lbuild")) < StrictVersion(min_lbuild_version):
print(f"modm requires at least lbuild v{min_lbuild_version}, please upgrade!\n"
" pip3 install -U lbuild")
exit(1)

min_modm_version = "0.2.0"
if StrictVersion(version("modm")) < StrictVersion(min_modm_version):
print(f"modm requires at least modm v{min_modm_version}, please upgrade!\n"
" pip3 install -U modm")
exit(1)

# Check for submodule existance and their version
Expand Down
4 changes: 2 additions & 2 deletions tools/modm_tools/jlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import time
import signal
import platform
import telnetlib
import telnetlib3
import subprocess

from . import gdb
Expand Down Expand Up @@ -102,7 +102,7 @@ def rtt(backend, channel=0):
# Start JLinkGDBServer in the background
with backend.scope():
time.sleep(0.5)
with telnetlib.Telnet("localhost", 19021) as tn:
with telnetlib3.Telnet("localhost", 19021) as tn:
try:
tn.interact()
except KeyboardInterrupt:
Expand Down
4 changes: 2 additions & 2 deletions tools/modm_tools/openocd.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import signal
import tempfile
import platform
import telnetlib
import telnetlib3
import subprocess

from . import utils
Expand Down Expand Up @@ -130,7 +130,7 @@ def rtt(backend, channel=0):
# Start OpenOCD in the background
with backend.scope():
time.sleep(0.5)
with telnetlib.Telnet("localhost", 9090+channel) as tn:
with telnetlib3.Telnet("localhost", 9090+channel) as tn:
try:
tn.interact()
except KeyboardInterrupt:
Expand Down

0 comments on commit 419fa4b

Please sign in to comment.