102 lines
3.9 KiB
Ruby
102 lines
3.9 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.26.tar.bz2"
|
|
sha256 "df6273dc5ef327a0eaf1ef1c46751fce4c0b7573880944e544287b85a068f770"
|
|
revision 2
|
|
|
|
bottle do
|
|
sha256 "b545489df056088a202e0505538c2f81e74e4b997f8659a0fa72c13f16321038" => :high_sierra
|
|
sha256 "6f23e45cf2609a29b769c3021f82c0ec83ae48592e597810b6234887c9d88f8f" => :sierra
|
|
sha256 "5d3da7df6c99092f318eb744adf4aff7d7caf757eb1f28619996516a2425987b" => :el_capitan
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "boost"
|
|
depends_on "boost-python3"
|
|
depends_on "cairomm"
|
|
depends_on "cgal"
|
|
depends_on "google-sparsehash"
|
|
depends_on "gtk+3"
|
|
depends_on "librsvg"
|
|
depends_on :macos => :el_capitan # needs thread-local storage
|
|
depends_on "numpy"
|
|
depends_on "py3cairo"
|
|
depends_on "pygobject3"
|
|
depends_on "python"
|
|
depends_on "scipy"
|
|
|
|
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/31/60/494fcce70d60a598c32ee00e71542e52e27c978e5f8219fae0d4ac6e2864/kiwisolver-1.0.1.tar.gz"
|
|
sha256 "ce3be5d520b4d2c3e5eeb4cd2ef62b9b9ab8ac6b6fedbaa0e39cdb6f50644278"
|
|
end
|
|
|
|
resource "matplotlib" do
|
|
url "https://files.pythonhosted.org/packages/ec/ed/46b835da53b7ed05bd4c6cae293f13ec26e877d2e490a53a709915a9dcb7/matplotlib-2.2.2.tar.gz"
|
|
sha256 "4dc7ef528aad21f22be85e95725234c5178c0f938e2228ca76640e5e84d8cde8"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz"
|
|
sha256 "0832bcf47acd283788593e7a0f542407bd9550a55a8a8435214a1960e04bcb04"
|
|
end
|
|
|
|
resource "python-dateutil" do
|
|
url "https://files.pythonhosted.org/packages/c5/39/4da7c2dbc4f023fba5fb2325febcadf0d0ce0efdc8bd12083a0f65d20653/python-dateutil-2.7.2.tar.gz"
|
|
sha256 "9d8074be4c993fbe4947878ce593052f71dac82932a677d49194d8ce9778002e"
|
|
end
|
|
|
|
resource "pytz" do
|
|
url "https://files.pythonhosted.org/packages/10/76/52efda4ef98e7544321fd8d5d512e11739c1df18b0649551aeccfb1c8376/pytz-2018.4.tar.gz"
|
|
sha256 "c06425302f2cf668f1bba7a0a03f3c1d34d4ebeef2c72003da308b3947c7f749"
|
|
end
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz"
|
|
sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
|
|
end
|
|
|
|
def install
|
|
xy = Language::Python.major_minor_version "python3"
|
|
|
|
venv = virtualenv_create(libexec, "python3")
|
|
|
|
resources.each do |r|
|
|
venv.pip_install_and_link r
|
|
end
|
|
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--prefix=#{prefix}",
|
|
"PYTHON=python3",
|
|
"PYTHON_LIBS=-undefined dynamic_lookup",
|
|
"--with-python-module-path=#{lib}/python#{xy}/site-packages",
|
|
"--with-boost-python=libboost-python36",
|
|
"--with-boost-python=36"
|
|
system "make", "install"
|
|
|
|
site_packages = "lib/python#{xy}/site-packages"
|
|
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.all 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
|