Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-tabulate: use venv #175440

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 12 additions & 32 deletions Formula/p/python-tabulate.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class PythonTabulate < Formula
include Language::Python::Virtualenv

desc "Pretty-print tabular data in Python"
homepage "https://github.com/astanin/python-tabulate"
url "https://files.pythonhosted.org/packages/ec/fe/802052aecb21e3797b8f7902564ab6ea0d60ff8ca23952079064155d1ae1/tabulate-0.9.0.tar.gz"
Expand All @@ -7,45 +9,23 @@ class PythonTabulate < Formula
revision 1

bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_sonoma: "6192893380cdad98357611640c0093ba73dc447b2625f75952cb77e24621b8f3"
sha256 cellar: :any_skip_relocation, arm64_ventura: "25317d4c2280da78334544b12f43a750e461bd639e377cdbc8db79fc5cf2af1f"
sha256 cellar: :any_skip_relocation, arm64_monterey: "530188e12213873fd771c261b559e48b0cd26b42e20c1324ec6b64ab426028ce"
sha256 cellar: :any_skip_relocation, sonoma: "a781d2bbbd0f8233087ba16954243be1c84a45138c2d0e1619c68635ea834abd"
sha256 cellar: :any_skip_relocation, ventura: "16f57ba4cdec4823690d6f1e100627c8ee8401df5ed257c39d034514b601aa12"
sha256 cellar: :any_skip_relocation, monterey: "4999cd9fd9e1ae46b802a439ab1f91cd9b2e18226e782206b7d37361849d627d"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4a2594750f8c12674c7932cf82e2b2e40b0aef5d91da0cf8fb4906ea8cd173e2"
rebuild 2
sha256 cellar: :any_skip_relocation, arm64_sonoma: "0512d6d0541a35bb5f78c28b6d03f75dd5356f4214feec5d57ddf29dee8ab0b6"
sha256 cellar: :any_skip_relocation, arm64_ventura: "0512d6d0541a35bb5f78c28b6d03f75dd5356f4214feec5d57ddf29dee8ab0b6"
sha256 cellar: :any_skip_relocation, arm64_monterey: "0512d6d0541a35bb5f78c28b6d03f75dd5356f4214feec5d57ddf29dee8ab0b6"
sha256 cellar: :any_skip_relocation, sonoma: "0512d6d0541a35bb5f78c28b6d03f75dd5356f4214feec5d57ddf29dee8ab0b6"
sha256 cellar: :any_skip_relocation, ventura: "0512d6d0541a35bb5f78c28b6d03f75dd5356f4214feec5d57ddf29dee8ab0b6"
sha256 cellar: :any_skip_relocation, monterey: "0512d6d0541a35bb5f78c28b6d03f75dd5356f4214feec5d57ddf29dee8ab0b6"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7f68075d1e03e127ee0fc20bcc6202d26823d36e7637ca2f52b9384b3d067a3b"
end

depends_on "python-setuptools" => :build
depends_on "[email protected]" => [:build, :test]
depends_on "[email protected]" => [:build, :test] # FIXME: should be runtime dependency

def pythons
deps.map(&:to_formula)
.select { |f| f.name.match?(/^python@\d\.\d+$/) }
.sort_by(&:version)
end
depends_on "[email protected]"

def install
pythons.each do |python|
python_exe = python.opt_libexec/"bin/python"
system python_exe, "-m", "pip", "install", *std_pip_args, "."
end
end

def caveats
<<~EOS
To run `tabulate`, you may need to `brew install #{pythons.last}`
EOS
virtualenv_install_with_resources
end

test do
pythons.each do |python|
python_exe = python.opt_libexec/"bin/python"
system python_exe, "-c", "from tabulate import tabulate"
end

(testpath/"in.txt").write <<~EOS
name qty
eggs 451
Expand Down
Loading