55 lines
1.9 KiB
Ruby
55 lines
1.9 KiB
Ruby
class Networkit < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Performance toolkit for large-scale network analysis"
|
|
homepage "https://networkit.github.io"
|
|
url "https://github.com/networkit/networkit.git",
|
|
tag: "7.1",
|
|
revision: "4c6dcc4367b51005a34221242048609c357ffbd6"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 "9ad19c9b34c80145ae33780156942bb83a092d7bc7c91701c75ae38d849fd867" => :catalina
|
|
sha256 "623478b0de8335e4547ba153e1c897276928c491c9150af1725941e758218906" => :mojave
|
|
sha256 "478b25c8e7df43389a444ab4368ce457912001d38501f1f4d248b96a10d24552" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "cython" => :build
|
|
depends_on "libnetworkit"
|
|
depends_on "numpy"
|
|
depends_on "python@3.8"
|
|
depends_on "scipy"
|
|
|
|
def install
|
|
xy = Language::Python.major_minor_version Formula["python@3.8"].opt_bin/"python3"
|
|
rpath_addons = Formula["libnetworkit"].opt_lib
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", libexec+"lib/python#{xy}/site-packages/"
|
|
ENV.append_path "PYTHONPATH", Formula["cython"].opt_libexec/"lib/python#{xy}/site-packages"
|
|
system Formula["python@3.8"].opt_bin/"python3", "setup.py", "build_ext",
|
|
"--networkit-external-core",
|
|
"--rpath=@loader_path;#{rpath_addons}"
|
|
system Formula["python@3.8"].opt_bin/"python3", "setup.py", "install",
|
|
"--single-version-externally-managed",
|
|
"--record=installed.txt",
|
|
"--prefix=#{libexec}"
|
|
site_packages = "lib/python#{xy}/site-packages"
|
|
pth_contents = "import site; site.addsitedir('#{libexec/site_packages}')\n"
|
|
(prefix/site_packages/"homebrew-networkit.pth").write pth_contents
|
|
end
|
|
|
|
test do
|
|
system Formula["python@3.8"].opt_bin/"python3", "-c", <<~EOS
|
|
import networkit as nk
|
|
G = nk.graph.Graph(3)
|
|
G.addEdge(0,1)
|
|
G.addEdge(1,2)
|
|
G.addEdge(2,0)
|
|
assert G.degree(0) == 2
|
|
assert G.degree(1) == 2
|
|
assert G.degree(2) == 2
|
|
EOS
|
|
end
|
|
end
|