Modernization and Python3

#955 · open · 3 comments

View on GitHub ↗

travisgoodspeed

This project was built with Python2 and an older version of the GCC compiler. We'll use this ticket to track updating the project to Python3, then validating fixes are appropriate before merging back to master. - [ ] `make dist` succeeds. - [ ] Firmware verified to run. - [ ] Fonts accurately replaced. Known bugs: - [ ] `gfxchecksum()` is broken

Comments

stannous

Just a quick workaround for lack of Python 2 in modern OSes: on Ubuntu 24.04 (noble), I used pyenv to install python 2.7.18 locally and was able to flash my md380: Changes for applet/Makefile ` --- Makefile.fixed 2026-02-04 14:49:36.208667790 -0500 +++ applet/Makefile 2026-02-04 15:15:02.627150034 -0500 @@ -91,13 +91,11 @@ CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 CFLAGS += -fshort-wchar -CFLAGS += -fcommon ifdef MKLISTING CFLAGS += -Wa,-a=$(@:.o=.lst) endif CFLAGS += -D$(FWDEFINE) CFLAGS += $(CIFLAGS) -LDFLAGS += --specs=nosys.specs ################################################### vpath %.c src @@ -162,7 +160,7 @@ $(SRCS): config.h src/*.h | lib applet.elf: $(SRCS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--no-wchar-size-warning -Wl,-Map,$(basename $@).map $^ -o $@ -Llib -lstm32f4 -Xlinker --just-symbols=src/symbols_$(SRCVERSION) + $(CC) $(CFLAGS) -Wl,--no-wchar-size-warning -Wl,-Map,$(basename $@).map $^ -o $@ -Llib -lstm32f4 -Xlinker --just-symbols=src/symbols_$(SRCVERSION) %.img: %.elf $(OBJDUMP) -t $< >$(basename $@).img.sym ` Now install and use pyenv python 2.7.18 locally: ` sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl https://pyenv.run | bash # place this in .bashrc and then start a new bash shell export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init - bash)" ##################### pyenv install 2.7.18 pyenv local 2.7.18 make flasha ` Hope this helps other python3/ubuntu users. --Sam

perryflynn

@stannous Hey, could you add code blocks to your comment here? It's hard to read/understand what you patched exactly.

perryflynn

Dump from by bash history to update the caller ID database on Debian Trixie ```txt 1009  pyenv --help 1012  export PYENV_ROOT="$HOME/.pyenv" 1013  eval "$(pyenv init - bash)" 1014  pyenv install 2.7.18 1015  pyenv local 2.7.18 1016  python --version 1020  pip install pyusb -U 1024  make updatedb 1027  make user.bin 1028  make flashdb ```