77 lines
3.6 KiB
Ruby
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/bb/d5/9d000803520b68fd9f6447cd7c15352a79984196f57f0519839b0f80fb8f/esptool-4.1.tar.gz"
|
|
sha256 "51a41655187780cb802a5827fab68a3db0d6206330560459c55fcf0e222f277f"
|
|
license "GPL-2.0-or-later"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "9c8c4cf36cf77ed0d2035351fe709e0bf2932f227995802e7d1abb310cc50ceb"
|
|
sha256 cellar: :any, arm64_big_sur: "938fb8c8cf7d99506aa3ed37671881133354ad7a57f68644904b700ccb0874b1"
|
|
sha256 cellar: :any, monterey: "139db1915c1438f02a93c4b904db9752a0ca4a91ca6a345a89afdf8a5f1a7272"
|
|
sha256 cellar: :any, big_sur: "b645b2d07a2be03536caefbe34fd7fa0c9a51412df803a7c4a7b92be7cf1a71e"
|
|
sha256 cellar: :any, catalina: "4ee4453cbb96da0f0474c94693aa31f070250261e6f1e8957f6ab9c7ef11c048"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "b975efcac04e9b487b8d2edddb05a8be985fd10633554a86e96405e1f279f3d4"
|
|
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/51/05/bb2b681f6a77276fc423d04187c39dafdb65b799c8d87b62ca82659f9ead/cryptography-37.0.2.tar.gz"
|
|
sha256 "f224ad253cc9cea7568f49077007d2263efa57396a2f2f78114066fd54b5c68e"
|
|
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/5e/0b/95d387f5f4433cb0f53ff7ad859bd2c6051051cebbb564f139a999ab46de/pycparser-2.21.tar.gz"
|
|
sha256 "e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"
|
|
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 --chip esp8266 image_info #{testpath}/helloworld-esp8266.bin")
|
|
assert_match "4010802c", result
|
|
end
|
|
end
|