class Tox < Formula include Language::Python::Virtualenv desc "Generic Python virtualenv management and test command-line tool" homepage "https://tox.readthedocs.org/" url "https://files.pythonhosted.org/packages/b1/6a/34536b8d39b1b4df5a933fe9a9db858e86a732c14de5f2775a47a889c09d/tox-3.13.0.tar.gz" sha256 "66d9ccf81b383ab1edc1619410223eec0e046178304728797a850302092ed975" bottle do cellar :any_skip_relocation sha256 "657f212a4e2355baff34bda5978e55f2bfcff566ea8eda13dda7f234ab581883" => :mojave sha256 "9cdcc55fc545e45c4a2cd4f1b16724539b5b10dfee78f16516d4fa6455c45c7e" => :high_sierra sha256 "671ea6933263a0a693e976ead1e6f3741580691fdc92a85134d9d26554ce2e42" => :sierra end depends_on "python" resource "filelock" do url "https://files.pythonhosted.org/packages/14/ec/6ee2168387ce0154632f856d5cc5592328e9cf93127c5c9aeca92c8c16cb/filelock-3.0.12.tar.gz" sha256 "18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59" end resource "importlib-metadata" do url "https://files.pythonhosted.org/packages/fd/5c/9caf9fe3d92afc3c0296c97b0fd72cacfcaf20e8b2c42306840914e052fa/importlib_metadata-0.18.tar.gz" sha256 "cb6ee23b46173539939964df59d3d72c3e0c1b5d54b84f1d8a7e912fe43612db" end resource "packaging" do url "https://files.pythonhosted.org/packages/16/51/d72654dbbaa4a4ffbf7cb0ecd7d12222979e0a660bf3f42acc47550bf098/packaging-19.0.tar.gz" sha256 "0c98a5d0be38ed775798ece1b9727178c4469d9c3b4ada66e8e6b7849f8732af" end resource "pluggy" do url "https://files.pythonhosted.org/packages/75/21/cdabca0144cfa282c2893dc8e07957245ac8657896ef3ea26f18b6fda710/pluggy-0.12.0.tar.gz" sha256 "0825a152ac059776623854c1543d65a4ad408eb3d33ee114dff91e57ec6ae6fc" end resource "py" do url "https://files.pythonhosted.org/packages/f1/5a/87ca5909f400a2de1561f1648883af74345fe96349f34f737cdfc94eba8c/py-1.8.0.tar.gz" sha256 "dc639b046a6e2cff5bbe40194ad65936d6ba360b52b3c3fe1d08a82dd50b5e53" end resource "pyparsing" do url "https://files.pythonhosted.org/packages/5d/3a/24d275393f493004aeb15a1beae2b4a3043526e8b692b65b4a9341450ebe/pyparsing-2.4.0.tar.gz" sha256 "1873c03321fc118f4e9746baf201ff990ceb915f433f23b395f5580d1840cb2a" end resource "six" do url "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz" sha256 "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" end resource "toml" do url "https://files.pythonhosted.org/packages/b9/19/5cbd78eac8b1783671c40e34bb0fa83133a06d340a38b55c645076d40094/toml-0.10.0.tar.gz" sha256 "229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c" end resource "virtualenv" do url "https://files.pythonhosted.org/packages/37/27/706af3ee62032933a3217454609c50a5325a6bd9c2c2f495b58c456ba286/virtualenv-16.6.1.tar.gz" sha256 "b7335cddd9260a3dd214b73a2521ffc09647bde3e9457fcca31dc3be3999d04a" end resource "zipp" do url "https://files.pythonhosted.org/packages/f9/c4/15a1260171956ed4f8190962b1771c7dbca4a39360c15f9c2b77e667a489/zipp-0.5.1.tar.gz" sha256 "ca943a7e809cc12257001ccfb99e3563da9af99d52f261725e96dfe0f9275bc3" 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 inreplace lib_python_path/"orig-prefix.txt", Formula["python"].opt_prefix, Formula["python"].prefix.realpath end test do ENV["LC_ALL"] = "en_US.UTF-8" pyver = Language::Python.major_minor_version("python3").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