homebrew-core/Formula/libpython-tabulate.rb

42 lines
1.2 KiB
Ruby

class LibpythonTabulate < Formula
desc "Pretty-print tabular data in Python"
homepage "https://pypi.org/project/tabulate/"
url "https://files.pythonhosted.org/packages/7a/53/afac341569b3fd558bf2b5428e925e2eb8753ad9627c1f9188104c6e0c4a/tabulate-0.8.10.tar.gz"
sha256 "6c57f3f3dd7ac2782770155f3adb2db0b1a269637e42f27599925e64b114f519"
license "MIT"
livecheck do
formula "python-tabulate"
end
bottle do
sha256 cellar: :any_skip_relocation, all: "761c33fc48f6ed2af1a83df2cddbdcd4f8090569a50cb8b0f25fcce1bfe0b091"
end
depends_on "python@3.10" => [:build, :test]
depends_on "python@3.9" => [:build, :test]
def pythons
deps.map(&:to_formula)
.select { |f| f.name.match?(/^python@\d\.\d+$/) }
.map { |f| f.opt_libexec/"bin/python" }
end
def install
pythons.each do |python|
system python, *Language::Python.setup_install_args(prefix, python)
end
# Remove bin folder, use tabulate from the python-tabulate formula instead.
# This is necessary to keep all the Python versions as build/test
# dependencies only for the libpython-tabulate
rm_rf prefix/"bin"
end
test do
pythons.each do |python|
system python, "-c", "from tabulate import tabulate"
end
end
end