homebrew-core/Formula/tox.rb

106 lines
4.2 KiB
Ruby

class Tox < Formula
include Language::Python::Virtualenv
desc "Generic Python virtualenv management and test command-line tool"
homepage "https://tox.readthedocs.io/"
url "https://files.pythonhosted.org/packages/b3/6e/18e2727acc690532309cfb6a2b2d71345c3b007bbb166178d178237e9594/tox-3.23.0.tar.gz"
sha256 "05a4dbd5e4d3d8269b72b55600f0b0303e2eb47ad5c6fe76d3576f4c58d93661"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "45b53cfa3dc89e039f809fa259d99a229a1ab8f8c513b60f8b5f4f8cdbb4f2d4"
sha256 cellar: :any_skip_relocation, big_sur: "dfa2b66bb903c21137f6315f399b1d9a50274a2f00cdd900fadbc51435e00b9e"
sha256 cellar: :any_skip_relocation, catalina: "634d9dff53aa35193606f04d7e79e32d46cd5bb7f7ef42a6a545d42342fa277f"
sha256 cellar: :any_skip_relocation, mojave: "5f37452ae3e840b3c3377f671b9f8fe9847b8db57b9db91553b02a77cc70594c"
end
depends_on "python@3.9"
resource "appdirs" do
url "https://files.pythonhosted.org/packages/d7/d8/05696357e0311f5b5c316d7b95f46c669dd9c15aaeecbb48c7d0aeb88c40/appdirs-1.4.4.tar.gz"
sha256 "7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"
end
resource "distlib" do
url "https://files.pythonhosted.org/packages/2f/83/1eba07997b8ba58d92b3e51445d5bf36f9fba9cb8166bcae99b9c3464841/distlib-0.3.1.zip"
sha256 "edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"
end
resource "filelock" do
url "https://files.pythonhosted.org/packages/14/ec/6ee2168387ce0154632f856d5cc5592328e9cf93127c5c9aeca92c8c16cb/filelock-3.0.12.tar.gz"
sha256 "18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/86/3c/bcd09ec5df7123abcf695009221a52f90438d877a2f1499453c6938f5728/packaging-20.9.tar.gz"
sha256 "5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"
end
resource "pluggy" do
url "https://files.pythonhosted.org/packages/f8/04/7a8542bed4b16a65c2714bf76cf5a0b026157da7f75e87cc88774aa10b14/pluggy-0.13.1.tar.gz"
sha256 "15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"
end
resource "py" do
url "https://files.pythonhosted.org/packages/0d/8c/50e9f3999419bb7d9639c37e83fa9cdcf0f601a9d407162d6c37ad60be71/py-1.10.0.tar.gz"
sha256 "21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/c1/47/dfc9c342c9842bbe0036c7f763d2d6686bcf5eb1808ba3e170afdb282210/pyparsing-2.4.7.tar.gz"
sha256 "c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"
end
resource "six" do
url "https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz"
sha256 "30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"
end
resource "toml" do
url "https://files.pythonhosted.org/packages/be/ba/1f744cdc819428fc6b5084ec34d9b30660f6f9daaf70eead706e3203ec3c/toml-0.10.2.tar.gz"
sha256 "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
end
resource "virtualenv" do
url "https://files.pythonhosted.org/packages/79/64/203241c2e2b5abfd5edca4e28242c21bf8a9e84490873e4a8a155a9658fc/virtualenv-20.4.2.tar.gz"
sha256 "147b43894e51dd6bba882cf9c282447f780e2251cd35172403745fc381a0a80d"
end
def install
virtualenv_install_with_resources
end
# Avoid relative paths
def post_install
lib_python_path = Pathname.glob(libexec/"lib/python*").first
lib_python_path.each_child do |f|
next unless f.symlink?
realpath = f.realpath
rm f
ln_s realpath, f
end
end
test do
ENV["LC_ALL"] = "en_US.UTF-8"
pyver = Language::Python.major_minor_version("python3.9").to_s.delete(".")
(testpath/"tox.ini").write <<~EOS
[tox]
envlist=py#{pyver}
skipsdist=True
[testenv]
deps=pytest
commands=pytest
EOS
(testpath/"test_trivial.py").write <<~EOS
def test_trivial():
assert True
EOS
assert_match "usage", shell_output("#{bin}/tox --help")
system "#{bin}/tox"
assert_predicate testpath/".tox/py#{pyver}", :exist?
end
end