class Certbot < Formula include Language::Python::Virtualenv desc "Tool to obtain certs from Let's Encrypt and autoenable HTTPS" homepage "https://certbot.eff.org/" url "https://files.pythonhosted.org/packages/57/98/b7aaf306718124b59541766a84cd065c0706e14f4a82c23c7b3ee63c51c5/certbot-5.3.0.tar.gz" sha256 "6b5214661803118d58d8fc0d59dd0c48b8b864456e9d90ba834f8eedf9dd67b6" license "Apache-2.0" head "https://github.com/certbot/certbot.git", branch: "main" bottle do sha256 cellar: :any, arm64_tahoe: "97ae545cfbc00bbcd7830619386fdd0af70d1dcf7cd8a176eaba53d34883462b" sha256 cellar: :any, arm64_sequoia: "de2d9faf496537645714c1d4325c2669b5da4601c392ead850d344cb391b21c3" sha256 cellar: :any, arm64_sonoma: "d71ef1304be3dd4226f2c18cc87fb33be854de0c9eadae4537c18f7ee5508d9c" sha256 cellar: :any, sonoma: "0647fd664c631e7dddf844aad3adc756d7af326655f3d522f61401b24e7cf2c8" sha256 cellar: :any_skip_relocation, arm64_linux: "bf12b077cd81b25970ed37572d9724f2f7c9c1f0e05ad842acef005d2ceb2bef" sha256 cellar: :any_skip_relocation, x86_64_linux: "936d54efb9db8ef6abca00213bfa91ed5ecdcf8fed4bed700a1ee9a22af8ed62" end depends_on "augeas" depends_on "certifi" => :no_linkage depends_on "cryptography" => :no_linkage depends_on "libyaml" depends_on "python@3.14" uses_from_macos "libffi" pypi_packages exclude_packages: ["certifi", "cryptography"], extra_packages: ["certbot-apache", "certbot-nginx", "certbot-dns-cloudflare"] resource "acme" do url "https://files.pythonhosted.org/packages/93/40/de20c39d903c4d1e47853d25b540e3124fc4784c8ab470a2fa37f5988b6f/acme-5.3.0.tar.gz" sha256 "015b6159ceb1cdf789aa79084e8f5e9e5f0515bb110d452aac03ad52db35bb74" end resource "attrs" do url "https://files.pythonhosted.org/packages/6b/5c/685e6633917e101e5dcb62b9dd76946cbb57c26e133bae9e0cd36033c0a9/attrs-25.4.0.tar.gz" sha256 "16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11" end resource "certbot-apache" do url "https://files.pythonhosted.org/packages/1c/e2/a0caa7617087e056687ab8be50d13b0dc52943bbd959110dc1e7c9661f0d/certbot_apache-5.3.0.tar.gz" sha256 "8e0768337b4bcbd33891d4841f4693c3a1e6649bffc52069a13012251209d757" end resource "certbot-dns-cloudflare" do url "https://files.pythonhosted.org/packages/cb/47/0a837c8f1ffe69662621311900b959caa4f533c7a4e5b18912d2ebcdbd81/certbot_dns_cloudflare-5.3.0.tar.gz" sha256 "60f1eca573d3726aa5a1a2f1177fb436d83ed7cb5514724cae8945c01b3f55a7" end resource "certbot-nginx" do url "https://files.pythonhosted.org/packages/2d/de/bbe95ceb562ab95f3e6f7eb02246362fb85bceb84869e44d0fb84a3b68ad/certbot_nginx-5.3.0.tar.gz" sha256 "3d9bf295692142e6617294c577bc019e48c284aee900acf23e8e912ae34c7be4" end resource "charset-normalizer" do url "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz" sha256 "94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a" end resource "cloudflare" do url "https://files.pythonhosted.org/packages/9b/8f/d3a435435c42d4b05ce2274432265c5890f91f6047e6dab52e50c811a4ea/cloudflare-2.19.4.tar.gz" sha256 "3b6000a01a237c23bccfdf6d20256ea5111ec74a826ae9e74f9f0e5bb5b2383f" end resource "configargparse" do url "https://files.pythonhosted.org/packages/85/4d/6c9ef746dfcc2a32e26f3860bb4a011c008c392b83eabdfb598d1a8bbe5d/configargparse-1.7.1.tar.gz" sha256 "79c2ddae836a1e5914b71d58e4b9adbd9f7779d4e6351a637b7d2d9b6c46d3d9" end resource "configobj" do url "https://files.pythonhosted.org/packages/f5/c4/c7f9e41bc2e5f8eeae4a08a01c91b2aea3dfab40a3e14b25e87e7db8d501/configobj-5.0.9.tar.gz" sha256 "03c881bbf23aa07bccf1b837005975993c4ab4427ba57f959afdd9d1a2386848" end resource "distro" do url "https://files.pythonhosted.org/packages/fc/f8/98eea607f65de6527f8a2e8885fc8015d3e6f5775df186e443e0964a11c3/distro-1.9.0.tar.gz" sha256 "2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed" end resource "idna" do url "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz" sha256 "795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902" end resource "josepy" do url "https://files.pythonhosted.org/packages/7f/ad/6f520aee9cc9618d33430380741e9ef859b2c560b1e7915e755c084f6bc0/josepy-2.2.0.tar.gz" sha256 "74c033151337c854f83efe5305a291686cef723b4b970c43cfe7270cf4a677a9" end resource "jsonlines" do url "https://files.pythonhosted.org/packages/35/87/bcda8e46c88d0e34cad2f09ee2d0c7f5957bccdb9791b0b934ec84d84be4/jsonlines-4.0.0.tar.gz" sha256 "0c6d2c09117550c089995247f605ae4cf77dd1533041d366351f6f298822ea74" end resource "parsedatetime" do url "https://files.pythonhosted.org/packages/a8/20/cb587f6672dbe585d101f590c3871d16e7aec5a576a1694997a3777312ac/parsedatetime-2.6.tar.gz" sha256 "4cb368fbb18a0b7231f4d76119165451c8d2e35951455dfee97c62a87b04d455" end resource "pyopenssl" do url "https://files.pythonhosted.org/packages/80/be/97b83a464498a79103036bc74d1038df4a7ef0e402cfaf4d5e113fb14759/pyopenssl-25.3.0.tar.gz" sha256 "c981cb0a3fd84e8602d7afc209522773b94c1c2446a3c710a75b06fe1beae329" end resource "pyparsing" do url "https://files.pythonhosted.org/packages/f3/91/9c6ee907786a473bf81c5f53cf703ba0957b23ab84c264080fb5a450416f/pyparsing-3.3.2.tar.gz" sha256 "c777f4d763f140633dcb6d8a3eda953bf7a214dc4eff598413c070bcdc117cbc" end resource "pyrfc3339" do url "https://files.pythonhosted.org/packages/b4/7f/3c194647ecb80ada6937c38a162ab3edba85a8b6a58fa2919405f4de2509/pyrfc3339-2.1.0.tar.gz" sha256 "c569a9714faf115cdb20b51e830e798c1f4de8dabb07f6ff25d221b5d09d8d7f" end resource "python-augeas" do url "https://files.pythonhosted.org/packages/44/f6/e09619a5a4393fe061e24a6f129c3e1fbb9f25f774bfc2f5ae82ba5e24d3/python-augeas-1.2.0.tar.gz" sha256 "d2334710e12bdec8b6633a7c2b72df4ca24ab79094a3c9e699494fdb62054a10" end resource "pyyaml" do url "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz" sha256 "d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f" end resource "requests" do url "https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz" sha256 "dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf" end resource "urllib3" do url "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz" sha256 "1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed" end def install if build.head? head_packages = %w[acme certbot certbot-apache certbot-nginx certbot-dns-cloudflare] venv = virtualenv_create(libexec, "python3.14") venv.pip_install resources.reject { |r| head_packages.include? r.name } venv.pip_install_and_link head_packages.map { |pkg| buildpath/pkg } pkgshare.install buildpath/"certbot/examples" else virtualenv_install_with_resources pkgshare.install buildpath/"examples" end end test do assert_match version.to_s, pipe_output("#{bin}/certbot --version 2>&1") # This throws a bad exit code but we can check it actually is failing # for the right reasons by asserting. --version never fails even if # resources are missing or outdated/too new/etc. assert_match "Either run as root", shell_output("#{bin}/certbot 2>&1", 1) end end