homebrew-core/Formula/esptool.rb

78 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"
revision 1
bottle do
sha256 cellar: :any, arm64_monterey: "74011061e4a4653c2f249402f7b6c2eb8e00fcda4b4e8355bea1c20487096ce0"
sha256 cellar: :any, arm64_big_sur: "7ff5d0f1168c00e6793634b93fefaddfee5ecd8a473b829a854f9c5f203f42b6"
sha256 cellar: :any, monterey: "f558be94d16775ef52d65784dfa9522e37b19fc6414d3de892c5c9e80eaf937c"
sha256 cellar: :any, big_sur: "18bd6da1c6043223de47829a32cba269279aa725b4b901c75e393db69af946d1"
sha256 cellar: :any, catalina: "75820854327d3f002f2c3e75bba6f56e85d2d57e0f83ec088c564290bf6089c8"
sha256 cellar: :any_skip_relocation, x86_64_linux: "e3b6a1c7d875fbbb1f225b45f886f6230f5bbc639f71be8832f989f6f82e18cf"
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/f9/4b/1cf8e281f7ae4046a59e5e39dd7471d46db9f61bb564fddbff9084c4334f/cryptography-36.0.1.tar.gz"
sha256 "53e5c1dc3d7a953de055d77bef2ff607ceef7a2aac0353b5d630ab67f7423638"
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 image_info #{testpath}/helloworld-esp8266.bin")
assert_match "4010802c", result
end
end