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 1 commit
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
28 changes: 4 additions & 24 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 @@ -17,35 +19,13 @@ class PythonTabulate < Formula
sha256 cellar: :any_skip_relocation, x86_64_linux: "4a2594750f8c12674c7932cf82e2b2e40b0aef5d91da0cf8fb4906ea8cd173e2"
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