homebrew-core/Formula/esptool.rb

80 lines
3.5 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/dd/3d/d1d4c004927e6e6807c441ce70330ed969c725d2906053fbd2ff994b4439/esptool-3.0.tar.gz"
sha256 "87953d235fed2c9adb1292b3769df0149686c9afdb1896dd963f730453cbc934"
license "GPL-2.0-or-later"
revision 2
bottle do
sha256 cellar: :any, arm64_big_sur: "29caa2064c93bf60c30012081d2f9ff98c7e6a2197613fd19bcb59225e8aa1a5"
sha256 cellar: :any, big_sur: "9d11746f99a1363c06b7fd1f2462d095268c1557dab200f389d66d59bfceecf9"
sha256 cellar: :any, catalina: "5070c01db9a963f97c27265e87e5e5afb52c824aa02fc1c4dc0a69a019e88771"
sha256 cellar: :any, mojave: "8d912a267508314803f308abb07620c80ec0440c84cb93c28357df2366ee037d"
end
depends_on "rust" => :build
depends_on "python@3.9"
resource "bitstring" do
url "https://files.pythonhosted.org/packages/c3/fc/ffac2c199d2efe1ec5111f55efeb78f5f2972456df6939fea849f103f9f5/bitstring-3.1.7.tar.gz"
sha256 "fdf3eb72b229d2864fb507f8f42b1b2c57af7ce5fec035972f9566de440a864a"
end
resource "cffi" do
url "https://files.pythonhosted.org/packages/a8/20/025f59f929bbcaa579704f443a438135918484fffaacfaddba776b374563/cffi-1.14.5.tar.gz"
sha256 "fd78e5fee591709f32ef6edb9a015b4aa1a5022598e36227500c8f4e02328d9c"
end
resource "cryptography" do
url "https://files.pythonhosted.org/packages/fa/2d/2154d8cb773064570f48ec0b60258a4522490fcb115a6c7c9423482ca993/cryptography-3.4.6.tar.gz"
sha256 "2d32223e5b0ee02943f32b19245b61a62db83a882f0e76cc564e1cec60d48f87"
end
resource "ecdsa" do
url "https://files.pythonhosted.org/packages/1d/d4/0684a83b3c16a9d1446ace27a506cef1db9b23984ac7ed6aaf764fdd56e8/ecdsa-0.16.1.tar.gz"
sha256 "cfc046a2ddd425adbd1a78b3c46f0d1325c657811c0f45ecc3a0a6236c1e50ff"
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
resource "six" do
url "https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz"
sha256 "30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"
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