Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Homebrew formula for installing graph-tool to Python 3
require 'formula'
class GraphTool < Formula
homepage 'http://graph-tool.skewed.de/'
url 'http://downloads.skewed.de/graph-tool/graph-tool-2.2.31.tar.bz2'
sha1 '5e0b1c215ecd76191a82c745df0fac17e33bfb09'
head 'https://github.com/count0/graph-tool.git'
depends_on 'pkg-config' => :build
depends_on 'boost' => 'c++11'
depends_on 'cgal' => 'c++11'
depends_on 'google-sparsehash' => ['c++11', :optional]
depends_on 'cairomm' => 'c++11'
depends_on 'py3cairo'
depends_on 'python3'
#depends_on 'matplotlib' => :python
#depends_on 'numpy' => :python
#depends_on 'scipy' => :python
def install
ENV.cxx11
config_args = %W[
--disable-debug
--disable-dependency-tracking
--disable-optimization
--prefix=#{prefix}
--with-python-module-path=/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
]
config_args << "--disable-sparsehash" if build.without? 'google-sparsehash'
system "./configure", "LDFLAGS=-L/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/config-3.4m -lpython3.4m ", "PYTHON_EXTRA_LDFLAGS=-Wl,-stack_size,1000000 -framework CoreFoundation /usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/Python ", *config_args
system "make", "install"
end
end

zwenthor commented Dec 4, 2014

thanks, this worked, but NOTE that this script has a python version hardcoded in it as "3.4.1". I had to change all instances of "3.4.1" to the latest version ("3.4.2_1" for me).
I also had trouble with the headers for py3cairo. configure looks for pycairo.h rather than py3cairo.h I'm not sure this is the correct fix, but i copied /usr/local/include/pycairo/py3cairo.h to /usr/local/include/pycairo/pycairo.h and that worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment