Skip to content

Commit

Permalink
comms/py-esphome-flasher: add port
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhuk-im committed Jun 17, 2024
1 parent 213b09c commit 0c9b823
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
52 changes: 52 additions & 0 deletions comms/py-esphome-flasher/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
PORTNAME= esphome-flasher
DISTVERSION= 1.4.0
CATEGORIES= comms python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

MAINTAINER= [email protected]
COMMENT= Simple GUI tool to flash ESPs over USB

LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE

USE_GITHUB= yes
GH_ACCOUNT= esphome
USES= python:3.7+
USE_PYTHON= autoplist distutils
USE_WX= 3.2+
WX_COMPS= python:run
DESKTOP_ENTRIES="ESPHome-Flasher" "${COMMENT}" \
"${PREFIX}/share/pixmaps/${PORTNAME}.ico" \
"esphomeflasher" "" true
PLIST_FILES= ${PREFIX}/share/pixmaps/${PORTNAME}.ico

RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}esptool>=3.2:comms/py-esptool@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}requests>=2.25.1:www/py-requests@${PY_FLAVOR}

post-patch:
.for __RUN_DEPEND in ${RUN_DEPENDS}
@${ECHO} -n "${__RUN_DEPEND:C/(.*)(>|<|==|>=|<=).*/\1/}: "
@${GREP} -E "^${__RUN_DEPEND:C/(.*)(>|<|==|>=|<=).*/\1/}(>|<|==|>=|<=)" \
${WRKSRC}/requirements.txt | \
${SED} -E "s/${__RUN_DEPEND:C/(.*)(>|<|==|>=|<=).*/\1/}(>|<|==|>=|<=)([.0-9]*)/\2/g" | \
${TR} -cd '[:print:]'
@${ECHO} " -> ${__RUN_DEPEND:C/.*(>|<|==|>=|<=)(.*)[:].*/\2/}"

@${REINPLACE_CMD} -E \
-e "s/(^|\")${__RUN_DEPEND:C/(.*)(>|<|==|>=|<=).*/\1/}(>|<|==|>=|<=)[.0-9]*/\1${__RUN_DEPEND:C/(.*)(>|<|==|>=|<=).*/\1/}>=${__RUN_DEPEND:C/.*(>|<|==|>=|<=)(.*)[:].*/\2/}/g" \
${WRKSRC}/setup.py \
${WRKSRC}/requirements.txt
.endfor
# Show all serial ports.
@${REINPLACE_CMD} -e 's| or "VID:PID" not in info||g' \
${WRKSRC}/esphomeflasher/helpers.py
# Patch for 4x esptool.
@${REINPLACE_CMD} -e 's|esptool.ESPLoader.detect_chip|esptool.cmds.detect_chip|g' \
-e 's|esptool.DETECTED_FLASH_SIZES.get|esptool.cmds.DETECTED_FLASH_SIZES.get|g' \
${WRKSRC}/esphomeflasher/common.py

post-install:
${INSTALL_DATA} ${WRKSRC}/icon.ico \
${STAGEDIR}${PREFIX}/share/pixmaps/${PORTNAME}.ico

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions comms/py-esphome-flasher/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1641801910
SHA256 (esphome-esphome-flasher-1.4.0_GH0.tar.gz) = 36054c3b9b2d66354dcafaf97ae629070a65732d30fd6a1e5ded3e0f052b6e60
SIZE (esphome-esphome-flasher-1.4.0_GH0.tar.gz) = 76985
15 changes: 15 additions & 0 deletions comms/py-esphome-flasher/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ESPHome-Flasher is a utility app for the ESPHome framework and is
designed to make flashing ESPs with ESPHome as simple as possible by:
- Having pre-built binaries for most operating systems.
- Hiding all non-essential options for flashing. All necessary options
for flashing (bootloader, flash mode) are automatically extracted from
the binary.

This project was originally intended to be a simple command-line tool,
but then I decided that a GUI would be nice. As I don't like writing
graphical front end code, the GUI largely is based on the NodeMCU
PyFlasher project.

The flashing process is done using the esptool library by espressif.

WWW: https://github.com/esphome/esphome-flasher

0 comments on commit 0c9b823

Please sign in to comment.