homebrew-core/Formula/esptool.rb

77 lines
3.6 KiB
Ruby

class Esptool < Formula
include Language::Python::Virtualenv
desc "ESP8266 and ESP32 serial bootloader utility"
homepage "https://github.com/espressif/esptool"
url "https://files.pythonhosted.org/packages/60/a4/33907f5b735f9179061bd6b6cae7123d4a2d0cdf46c879fa55e66edef24f/esptool-3.2.tar.gz"
sha256 "9638ff11c68e621e08e7c3335d4fd9d70b2ddcf7caae778073cd8cc27be1216f"
license "GPL-2.0-or-later"
bottle do
sha256 cellar: :any, arm64_monterey: "9c52ff396b766dc0d886049143a1e07ae5a4ae66fd9324d8d7086e4cc4300278"
sha256 cellar: :any, arm64_big_sur: "dd42a3301e863b412b9a51a73359b6f3cc030abc0aee8a7b02a6432e0bceeb11"
sha256 cellar: :any, monterey: "f0c4671413f88b73105da8362db9aaf9bc41a6b21a26b60a9bb8d6bd06ea8d25"
sha256 cellar: :any, big_sur: "0cfc27468d292253ff44cb4a51176b68e472fa3bad740235eaaa419d7bcb3eec"
sha256 cellar: :any, catalina: "06d4d81d98e1bb77bd2c975658179b9a1c13b01a51ef5d44c887c13401a0e8d9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "0a83eeba0b8aa49af1da4af3f3c21b3396221a5b0b9100df7bf7a4170d943b68"
end
depends_on "rust" => :build
depends_on "python@3.10"
depends_on "six"
resource "bitstring" do
url "https://files.pythonhosted.org/packages/4c/b1/80d58eeb21c9d4ca739770558d61f6adacb13aa4908f4f55e0974cbd25ee/bitstring-3.1.9.tar.gz"
sha256 "a5848a3f63111785224dca8bb4c0a75b62ecdef56a042c8d6be74b16f7e860e7"
end
resource "cffi" do
url "https://files.pythonhosted.org/packages/00/9e/92de7e1217ccc3d5f352ba21e52398372525765b2e0c4530e6eb2ba9282a/cffi-1.15.0.tar.gz"
sha256 "920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954"
end
resource "cryptography" do
url "https://files.pythonhosted.org/packages/10/91/90b8d4cd611ac2aa526290ae4b4285aa5ea57ee191c63c2f3d04170d7683/cryptography-35.0.0.tar.gz"
sha256 "9933f28f70d0517686bd7de36166dda42094eac49415459d9bdf5e7df3e0086d"
end
resource "ecdsa" do
url "https://files.pythonhosted.org/packages/bf/3d/3d909532ad541651390bf1321e097404cbd39d1d89c2046f42a460220fb3/ecdsa-0.17.0.tar.gz"
sha256 "b9f500bb439e4153d0330610f5d26baaf18d17b8ced1bc54410d189385ea68aa"
end
resource "pycparser" do
url "https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz"
sha256 "2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"
end
resource "pyserial" do
url "https://files.pythonhosted.org/packages/1e/7d/ae3f0a63f41e4d2f6cb66a5b57197850f919f59e558159a4dd3a818f5082/pyserial-3.5.tar.gz"
sha256 "3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb"
end
resource "reedsolo" do
url "https://files.pythonhosted.org/packages/c8/cb/bb2ddbd00c9b4215dd57a2abf7042b0ae222b44522c5eb664a8fd9d786da/reedsolo-1.5.4.tar.gz"
sha256 "b8b25cdc83478ccb06361a0e8fadc27b376a3dfabbb1dc6bb583a998a22c0127"
end
def install
virtualenv_install_with_resources
end
test do
require "base64"
assert_match version.to_s, shell_output("#{bin}/esptool.py version")
assert_match "usage: espefuse.py", shell_output("#{bin}/espefuse.py --help")
assert_match version.to_s, shell_output("#{bin}/espsecure.py --help")
(testpath/"helloworld-esp8266.bin").write ::Base64.decode64 <<~EOS
6QIAICyAEEAAgBBAMAAAAFDDAAAAgP4/zC4AQMwkAEAh/P8SwfAJMQH8/8AAACH5/wH6/8AAAAb//wAABvj/AACA/j8QAAAASGVsbG8gd29ybGQhCgAAAAAAAAAAAAAD
EOS
result = shell_output("#{bin}/esptool.py image_info #{testpath}/helloworld-esp8266.bin")
assert_match "4010802c", result
end
end