103 lines
3.6 KiB
Ruby
103 lines
3.6 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.29.tar.bz2"
|
|
sha256 "6c0c4336bed6e2f79c91ace6d6914145ee03d0bd5025473b5918aec2b0657f7a"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "1f996b31dfb36bd8cb6a0e8162df27820fdebadd76f8d6650e6b09f5f61576e1" => :mojave
|
|
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 => :mojave # for C++17
|
|
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/16/e7/df58eb8868d183223692d2a62529a594f6414964a3ae93548467b146a24d/kiwisolver-1.1.0.tar.gz"
|
|
sha256 "53eaed412477c836e1b9522c19858a8557d6e595077830146182225613b11a75"
|
|
end
|
|
|
|
resource "matplotlib" do
|
|
url "https://files.pythonhosted.org/packages/12/d1/7b12cd79c791348cb0c78ce6e7d16bd72992f13c9f1e8e43d2725a6d8adf/matplotlib-3.1.1.tar.gz"
|
|
sha256 "1febd22afe1489b13c6749ea059d392c03261b2950d1d45c17e3aed812080c93"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/5d/3a/24d275393f493004aeb15a1beae2b4a3043526e8b692b65b4a9341450ebe/pyparsing-2.4.0.tar.gz"
|
|
sha256 "1873c03321fc118f4e9746baf201ff990ceb915f433f23b395f5580d1840cb2a"
|
|
end
|
|
|
|
resource "python-dateutil" do
|
|
url "https://files.pythonhosted.org/packages/ad/99/5b2e99737edeb28c71bcbec5b5dda19d0d9ef3ca3e92e3e925e7c0bb364c/python-dateutil-2.8.0.tar.gz"
|
|
sha256 "c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e"
|
|
end
|
|
|
|
resource "pytz" do
|
|
url "https://files.pythonhosted.org/packages/df/d5/3e3ff673e8f3096921b3f1b79ce04b832e0100b4741573154b72b756a681/pytz-2019.1.tar.gz"
|
|
sha256 "d747dd3d23d77ef44c6a3526e274af6efeb0a6f1afd5a69ba4d5be4098c8e141"
|
|
end
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"
|
|
sha256 "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
|
|
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
|
|
|
|
args = %W[
|
|
--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=boost_python#{xy.to_s.delete(".")}-mt
|
|
]
|
|
args << "--with-expat=#{MacOS.sdk_path}/usr" if MacOS.sdk_path_if_needed
|
|
|
|
system "./configure", *args
|
|
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 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
|