homebrew-core/Formula/tox.rb

110 lines
4.6 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/bc/72/e799ba961ce78daefe170e2c5da87813bc9084e25151d81c577fbf3fe2be/tox-4.2.4.tar.gz"
sha256 "05b1cbf94e02eff40818860b352b4a452d7369558f3bb05809043c6b4c36e5f4"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, arm64_ventura: "72b1babd9f5ab4f38185de67e4d3885bd268b2bee2b2fad80cd3fcd1ef07809d"
sha256 cellar: :any_skip_relocation, arm64_monterey: "24ea259791a19247ea7b451cfe2ea3d57674363a06378261959f517c9997affa"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "eaf9dd706a7b19bfdbe1d0f2f9aff4c9656f21037768619fd762ae4dcd6dd17a"
sha256 cellar: :any_skip_relocation, ventura: "6b7bc2ad05482cceebab98c781580f1919aed606d15720761f9bb28bd734e553"
sha256 cellar: :any_skip_relocation, monterey: "9c95703c2c4052298f0b2840f9bb826d6a1d980ef774f77655b2fad6ad38ee47"
sha256 cellar: :any_skip_relocation, big_sur: "04b701edd489380b10401fb1f17292b02e53aebc4023feff3302dca56fd1fa2f"
sha256 cellar: :any_skip_relocation, x86_64_linux: "1afb36ad4e64050512ca935775b4770ea85200ebbdcaada66e683f333853d126"
end
depends_on "python@3.11"
depends_on "six"
resource "cachetools" do
url "https://files.pythonhosted.org/packages/c2/6f/278225c5a070a18a76f85db5f1238f66476579fa9b04cda3722331dcc90f/cachetools-5.2.0.tar.gz"
sha256 "6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757"
end
resource "chardet" do
url "https://files.pythonhosted.org/packages/41/32/cdc91dcf83849c7385bf8e2a5693d87376536ed000807fa07f5eab33430d/chardet-5.1.0.tar.gz"
sha256 "0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5"
end
resource "colorama" do
url "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz"
sha256 "08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"
end
resource "distlib" do
url "https://files.pythonhosted.org/packages/58/07/815476ae605bcc5f95c87a62b95e74a1bce0878bc7a3119bc2bf4178f175/distlib-0.3.6.tar.gz"
sha256 "14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"
end
resource "filelock" do
url "https://files.pythonhosted.org/packages/0b/dc/eac02350f06c6ed78a655ceb04047df01b02c6b7ea3fc02d4df24ca87d24/filelock-3.9.0.tar.gz"
sha256 "7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/6b/f7/c240d7654ddd2d2f3f328d8468d4f1f876865f6b9038b146bec0a6737c65/packaging-22.0.tar.gz"
sha256 "2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3"
end
resource "platformdirs" do
url "https://files.pythonhosted.org/packages/cf/4d/198b7e6c6c2b152f4f9f4cdf975d3590e33e63f1920f2d89af7f0390e6db/platformdirs-2.6.2.tar.gz"
sha256 "e1fea1fe471b9ff8332e229df3cb7de4f53eeea4998d3b6bfff542115e998bd2"
end
resource "pluggy" do
url "https://files.pythonhosted.org/packages/a1/16/db2d7de3474b6e37cbb9c008965ee63835bba517e22cdb8c35b5116b5ce1/pluggy-1.0.0.tar.gz"
sha256 "4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"
end
resource "pyproject-api" do
url "https://files.pythonhosted.org/packages/08/87/d1d350a5aa74baf598030fcdadc78b42a83014a3c0583354f4b5ecf1cf14/pyproject_api-1.4.0.tar.gz"
sha256 "ac85c1f82e0291dbae5a7739dbb9a990e11ee4034c9b5599ea714f07a24ecd71"
end
resource "virtualenv" do
url "https://files.pythonhosted.org/packages/7b/19/65f13cff26c8cc11fdfcb0499cd8f13388dd7b35a79a376755f152b42d86/virtualenv-20.17.1.tar.gz"
sha256 "f8b927684efc6f1cc206c9db297a570ab9ad0e51c16fa9e45487d36d1905c058"
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(Formula["python@3.11"].opt_bin/"python3.11").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