136 lines
5.0 KiB
Ruby
136 lines
5.0 KiB
Ruby
class GraphTool < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Efficient network analysis for Python 3"
|
|
homepage "https://graph-tool.skewed.de/"
|
|
url "https://downloads.skewed.de/graph-tool/graph-tool-2.45.tar.bz2"
|
|
sha256 "f92da7accfda02b29791efe4f0b3ed93329f27232af4d3afc07c92421ec68668"
|
|
license "LGPL-3.0-or-later"
|
|
revision 2
|
|
|
|
livecheck do
|
|
url "https://downloads.skewed.de/graph-tool/"
|
|
regex(/href=.*?graph-tool[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 arm64_monterey: "7666e269c3827264844b42dd7a27b807e7d91000576fa2b20b19cdb36e9a7ff4"
|
|
sha256 arm64_big_sur: "42488ecf30763dfd9f7161b18b28ecea228b6e144f593e7390d63fb93a16f342"
|
|
sha256 monterey: "1f7412f6f547232351b539f7da2b22de7a6ea767c0893abbac6187da0d563333"
|
|
sha256 big_sur: "6770f6eed5f5f02ffc557e8bf4da18b14b683755f925933c32fd7be0d628b25d"
|
|
sha256 catalina: "02272277f85ed501816ba50d5de712ed643ad6989694b93d997172687fb477df"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "1961970eba1b4d4e1e777233a406ec180a77faf79a3e488b212777966aee1489"
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "boost"
|
|
depends_on "boost-python3"
|
|
depends_on "cairomm@1.14"
|
|
depends_on "cgal"
|
|
depends_on "google-sparsehash"
|
|
depends_on "gtk+3"
|
|
depends_on "librsvg"
|
|
depends_on macos: :mojave # for C++17
|
|
depends_on "numpy"
|
|
depends_on "py3cairo"
|
|
depends_on "pygobject3"
|
|
depends_on "python@3.10"
|
|
depends_on "scipy"
|
|
depends_on "six"
|
|
|
|
uses_from_macos "expat" => :build
|
|
|
|
fails_with gcc: "5"
|
|
|
|
resource "Cycler" do
|
|
url "https://files.pythonhosted.org/packages/c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488/cycler-0.10.0.tar.gz"
|
|
sha256 "cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8"
|
|
end
|
|
|
|
resource "kiwisolver" do
|
|
url "https://files.pythonhosted.org/packages/90/55/399ab9f2e171047d28933ae4b686d9382d17e6c09a01bead4a6f6b5038f4/kiwisolver-1.3.1.tar.gz"
|
|
sha256 "950a199911a8d94683a6b10321f9345d5a3a8433ec58b217ace979e18f16e248"
|
|
end
|
|
|
|
resource "matplotlib" do
|
|
url "https://files.pythonhosted.org/packages/60/d3/286925802edaeb0b8834425ad97c9564ff679eb4208a184533969aa5fc29/matplotlib-3.4.2.tar.gz"
|
|
sha256 "d8d994cefdff9aaba45166eb3de4f5211adb4accac85cbf97137e98f26ea0219"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/c1/47/dfc9c342c9842bbe0036c7f763d2d6686bcf5eb1808ba3e170afdb282210/pyparsing-2.4.7.tar.gz"
|
|
sha256 "c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"
|
|
end
|
|
|
|
resource "python-dateutil" do
|
|
url "https://files.pythonhosted.org/packages/be/ed/5bbc91f03fa4c839c4c7360375da77f9659af5f7086b7a7bdda65771c8e0/python-dateutil-2.8.1.tar.gz"
|
|
sha256 "73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"
|
|
end
|
|
|
|
resource "pytz" do
|
|
url "https://files.pythonhosted.org/packages/b0/61/eddc6eb2c682ea6fd97a7e1018a6294be80dba08fa28e7a3570148b4612d/pytz-2021.1.tar.gz"
|
|
sha256 "83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da"
|
|
end
|
|
|
|
resource "zstandard" do
|
|
url "https://files.pythonhosted.org/packages/b4/79/7b192e51a2952dee3a3c9dbd9208a9838d8d497745a18a5528e2dbfb465e/zstandard-0.15.2.tar.gz"
|
|
sha256 "52de08355fd5cfb3ef4533891092bb96229d43c2069703d4aff04fdbedf9c92f"
|
|
end
|
|
|
|
def python3
|
|
deps.map(&:to_formula)
|
|
.find { |f| f.name.match?(/^python@\d\.\d+$/) }
|
|
.opt_libexec/"bin/python"
|
|
end
|
|
|
|
def install
|
|
# Linux build is not thread-safe.
|
|
ENV.deparallelize unless OS.mac?
|
|
|
|
system "autoreconf", "--force", "--install", "--verbose"
|
|
site_packages = Language::Python.site_packages(python3)
|
|
xy = Language::Python.major_minor_version(python3)
|
|
venv = virtualenv_create(libexec, python3)
|
|
|
|
resources.each do |r|
|
|
venv.pip_install_and_link r
|
|
end
|
|
|
|
args = [
|
|
"--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--prefix=#{prefix}",
|
|
"PYTHON=python3",
|
|
"--with-python-module-path=#{prefix/site_packages}",
|
|
"--with-boost-python=boost_python#{xy.to_s.delete(".")}-mt",
|
|
"--with-boost-libdir=#{Formula["boost"].opt_lib}",
|
|
"--with-boost-coroutine=boost_coroutine-mt",
|
|
]
|
|
args << "--with-expat=#{MacOS.sdk_path}/usr" if MacOS.sdk_path_if_needed
|
|
args << "PYTHON_LIBS=-undefined dynamic_lookup" if OS.mac?
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
|
|
pth_contents = "import site; site.addsitedir('#{libexec/site_packages}')\n"
|
|
(prefix/site_packages/"homebrew-graph-tool.pth").write pth_contents
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.py").write <<~EOS
|
|
import graph_tool as gt
|
|
g = gt.Graph()
|
|
v1 = g.add_vertex()
|
|
v2 = g.add_vertex()
|
|
e = g.add_edge(v1, v2)
|
|
assert g.num_edges() == 1
|
|
assert g.num_vertices() == 2
|
|
EOS
|
|
system python3, "test.py"
|
|
end
|
|
end
|