class Buku < Formula include Language::Python::Virtualenv desc "Command-line bookmark manager" homepage "https://github.com/jarun/Buku" url "https://github.com/jarun/Buku/archive/v2.7.tar.gz" sha256 "9ebc95a665e56460d91b9d98711f1eba722b14a14a058e2ef330b117b79943fe" revision 1 bottle do sha256 "9b3511452cb07c82bc2a62d18689adec92fac87aa584d7b6b9cf75a19c81fb58" => :sierra sha256 "26ec6a9fd5b9eef52a054e13330040f2817b0d87d3008774731f40b01fedef32" => :el_capitan sha256 "3987c15d09d55c9be482cd3621e9f6181d108b7fb864d045b90440031d33a20b" => :yosemite end depends_on :python3 depends_on "openssl@1.1" resource "beautifulsoup4" do url "https://files.pythonhosted.org/packages/86/ea/8e9fbce5c8405b9614f1fd304f7109d9169a3516a493ce4f7f77c39435b7/beautifulsoup4-4.5.1.tar.gz" sha256 "3c9474036afda9136aac6463def733f81017bf9ef3510d25634f335b0c87f5e1" end resource "cffi" do url "https://files.pythonhosted.org/packages/a1/32/e3d6c3a8b5461b903651dd6ce958ed03c093d2e00128e3f33ea69f1d7965/cffi-1.9.1.tar.gz" sha256 "563e0bd53fda03c151573217b3a49b3abad8813de9dd0632e10090f6190fdaf8" end resource "cryptography" do url "https://files.pythonhosted.org/packages/d7/a2/b90736c37fd720db425c5e48d69da75a6eff6609b22d2123762f1ae8c5f5/cryptography-1.6.tar.gz" sha256 "4d0d86d2c8d3fc89133c3fa0d164a688a458b6663ab6fa965c80d6c2cdaf9b3f" end resource "idna" do url "https://files.pythonhosted.org/packages/fb/84/8c27516fbaa8147acd2e431086b473c453c428e24e8fb99a1d89ce381851/idna-2.1.tar.gz" sha256 "ed36f281aebf3cd0797f163bb165d84c31507cedd15928b095b1675e2d04c676" end resource "pyasn1" do url "https://files.pythonhosted.org/packages/f7/83/377e3dd2e95f9020dbd0dfd3c47aaa7deebe3c68d3857a4e51917146ae8b/pyasn1-0.1.9.tar.gz" sha256 "853cacd96d1f701ddd67aa03ecc05f51890135b7262e922710112f12a2ed2a7f" end resource "pycparser" do url "https://files.pythonhosted.org/packages/be/64/1bb257ffb17d01f4a38d7ce686809a736837ad4371bcc5c42ba7a715c3ac/pycparser-2.17.tar.gz" sha256 "0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6" end resource "pyOpenSSL" do url "https://files.pythonhosted.org/packages/0c/d6/b1fe519846a21614fa4f8233361574eddb223e0bc36b182140d916acfb3b/pyOpenSSL-16.2.0.tar.gz" sha256 "7779a3bbb74e79db234af6a08775568c6769b5821faecf6e2f4143edb227516e" end resource "requests" do url "https://files.pythonhosted.org/packages/6e/40/7434b2d9fe24107ada25ec90a1fc646e97f346130a2c51aa6a2b1aba28de/requests-2.12.1.tar.gz" sha256 "2109ecea94df90980be040490ff1d879971b024861539abb00054062388b612e" end resource "six" do url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz" sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a" end resource "urllib3" do url "https://files.pythonhosted.org/packages/b4/cb/0f195aa96fd63a4ef8b3578c67f56eb0804e394d9789080a8862c06c2f68/urllib3-1.19.1.tar.gz" sha256 "53bc34c8ee268c3bd83ecf5e9c80fa783f3148484579bd4e20f4a7c1bb2dd6a0" end def install venv = virtualenv_create(libexec, "python3") venv.pip_install resources # Replace shebang with virtualenv python inreplace "buku.py", "#!/usr/bin/env python3", "#!#{libexec}/bin/python" bin.install "buku.py" => "buku" man1.install "buku.1" bash_completion.install "auto-completion/bash/buku-completion.bash" fish_completion.install "auto-completion/fish/buku.fish" zsh_completion.install "auto-completion/zsh/_buku" end test do ENV["XDG_DATA_HOME"] = "#{testpath}/.local/share" # Firefox exported bookmarks file (testpath/"bookmarks.html").write <<-EOS.undent