homebrew-core/Formula/alot.rb

136 lines
5.8 KiB
Ruby

class Alot < Formula
include Language::Python::Virtualenv
desc "Text mode MUA using notmuch mail"
homepage "https://github.com/pazz/alot"
url "https://github.com/pazz/alot/archive/0.10.tar.gz"
sha256 "71f382aa751fb90fde1a06a0a4ba43628ee6aa6d41b5cd53c8701fd7c5ab6e6e"
license "GPL-3.0-only"
revision 1
head "https://github.com/pazz/alot.git", branch: "master"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_monterey: "555f0a1bd748b45788f2c2fdb6f5180aac065fde8c62f08b7604be005471fdde"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "893b411b1dff0d8d1cdedc74a46c59f1564a988e0af6d8f949d419147f6897c9"
sha256 cellar: :any_skip_relocation, monterey: "5e121e31acb656955cc38518dbed23f7956198c16292b26ba7bed462151d3f25"
sha256 cellar: :any_skip_relocation, big_sur: "a277a9ceeb0ce579f091720ad0dc9771bef20fc0a9d5ef3ec55fde46d4249f9d"
sha256 cellar: :any_skip_relocation, catalina: "3cc9b6b7ea1a752f57f175db8e065a853e6d2c021587408a0dedd380534db0e5"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6a704bd3b97cef006fa215c85b999be59fa6ed8d710365fa2af3d4f028068317"
end
depends_on "sphinx-doc" => :build
depends_on "swig" => :build
depends_on "gpgme"
depends_on "libmagic"
depends_on "notmuch"
depends_on "python-typing-extensions"
depends_on "python@3.10"
depends_on "six"
resource "Automat" do
url "https://files.pythonhosted.org/packages/80/c5/82c63bad570f4ef745cc5c2f0713c8eddcd07153b4bee7f72a8dc9f9384b/Automat-20.2.0.tar.gz"
sha256 "7979803c74610e11ef0c0d68a2942b152df52da55336e0c9d58daf1831cbdf33"
end
resource "Twisted" do
url "https://files.pythonhosted.org/packages/fb/1e/fffa0d45da0ed2998e4d7f121621f2de68c51153fbbab23e63901cf859f4/Twisted-22.4.0.tar.gz"
sha256 "a047990f57dfae1e0bd2b7df2526d4f16dcdc843774dc108b78c52f2a5f13680"
end
resource "attrs" do
url "https://files.pythonhosted.org/packages/d7/77/ebb15fc26d0f815839ecd897b919ed6d85c050feeb83e100e020df9153d2/attrs-21.4.0.tar.gz"
sha256 "626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"
end
resource "configobj" do
url "https://files.pythonhosted.org/packages/64/61/079eb60459c44929e684fa7d9e2fdca403f67d64dd9dbac27296be2e0fab/configobj-5.0.6.tar.gz"
sha256 "a2f5650770e1c87fb335af19a9b7eb73fc05ccf22144eb68db7d00cd2bcb0902"
end
resource "constantly" do
url "https://files.pythonhosted.org/packages/95/f1/207a0a478c4bb34b1b49d5915e2db574cadc415c9ac3a7ef17e29b2e8951/constantly-15.1.0.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
end
resource "hyperlink" do
url "https://files.pythonhosted.org/packages/3a/51/1947bd81d75af87e3bb9e34593a4cf118115a8feb451ce7a69044ef1412e/hyperlink-21.0.0.tar.gz"
sha256 "427af957daa58bc909471c6c40f74c5450fa123dd093fc53efd2e91d2705a56b"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/62/08/e3fc7c8161090f742f504f40b1bccbfc544d4a4e09eb774bf40aafce5436/idna-3.3.tar.gz"
sha256 "9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
end
resource "incremental" do
url "https://files.pythonhosted.org/packages/4f/c5/430765c697afc217c8491785de321a21fa4d983dda14bcd82feb965b0593/incremental-21.3.0.tar.gz"
sha256 "02f5de5aff48f6b9f665d99d48bfc7ec03b6e3943210de7cfc88856d755d6f57"
end
resource "mock" do
url "https://files.pythonhosted.org/packages/e2/be/3ea39a8fd4ed3f9a25aae18a1bff2df7a610bca93c8ede7475e32d8b73a0/mock-4.0.3.tar.gz"
sha256 "7d3fbbde18228f4ff2f1f119a45cdffa458b4c0dee32eb4d2bb2f82554bac7bc"
end
resource "python-magic" do
url "https://files.pythonhosted.org/packages/f7/46/fecfd32c126d26c8dd5287095cad01356ec0a761205f0b9255998bff96d1/python-magic-0.4.25.tar.gz"
sha256 "21f5f542aa0330f5c8a64442528542f6215c8e18d2466b399b0d9d39356d83fc"
end
resource "urwid" do
url "https://files.pythonhosted.org/packages/94/3f/e3010f4a11c08a5690540f7ebd0b0d251cc8a456895b7e49be201f73540c/urwid-2.1.2.tar.gz"
sha256 "588bee9c1cb208d0906a9f73c613d2bd32c3ed3702012f51efe318a3f2127eae"
end
resource "urwidtrees" do
url "https://files.pythonhosted.org/packages/43/e1/ca5cf122cf1121b55acb39a1fb7e9fb1283c2eb0dc75fca751eb8c16b2f9/urwidtrees-1.0.3.tar.gz"
sha256 "50b19c06b03a5a73e561757a26d449cfe0c08afabe5c0f3cd4435596bdddaae9"
end
resource "zope.interface" do
url "https://files.pythonhosted.org/packages/ae/58/e0877f58daa69126a5fb325d6df92b20b77431cd281e189c5ec42b722f58/zope.interface-5.4.0.tar.gz"
sha256 "5dba5f530fec3f0988d83b78cc591b58c0b6eb8431a85edd1569a0539a8a5a0e"
end
def install
virtualenv_install_with_resources
python = "python3.10"
# Add path configuration file to use notmuch CFFI bindings
site_packages = Language::Python.site_packages(python)
pth_contents = "import site; site.addsitedir('#{Formula["notmuch"].opt_libexec/site_packages}')\n"
(libexec/site_packages/"homebrew-notmuch2.pth").write pth_contents
pkgshare.install Pathname("extra").children - [Pathname("extra/completion")]
zsh_completion.install "extra/completion/alot-completion.zsh" => "_alot"
ENV["LC_ALL"] = "en_US.UTF-8"
ENV["SPHINXBUILD"] = Formula["sphinx-doc"].opt_bin/"sphinx-build"
cd "docs" do
system "make", "pickle"
system "make", "man", "html"
man1.install "build/man/alot.1"
doc.install Pathname("build/html").children
end
end
test do
(testpath/".notmuch-config").write <<~EOS
[database]
path=#{testpath}/Mail
EOS
(testpath/"Mail").mkpath
system Formula["notmuch"].bin/"notmuch", "new"
require "pty"
PTY.spawn(bin/"alot", "--logfile", testpath/"out.log") do |_r, _w, pid|
sleep 10
Process.kill 9, pid
end
assert_predicate testpath/"out.log", :exist?, "out.log file should exist"
assert_match "setup gui", (testpath/"out.log").read
end
end