homebrew-core/Formula/pygobject3.rb

65 lines
2 KiB
Ruby
Raw Normal View History

require 'formula'
class Pygobject3 < Formula
homepage 'http://live.gnome.org/PyGObject'
2013-11-18 15:47:34 +00:00
url 'http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.10/pygobject-3.10.2.tar.xz'
sha256 '75608f2c4052f0277508fc79debef026d9e84cb9261de2b922387c093d32c326'
option 'with-tests', 'run tests'
depends_on 'pkg-config' => :build
# these dependencies are not required for `brew test`, but rather for
# the tests included with the source code.
if build.with? 'tests'
depends_on 'automake' => :build
depends_on 'autoconf' => :build
depends_on 'libtool' => :build
depends_on 'gnome-common' => :build
depends_on 'gtk+3' => :build
end
depends_on 'libffi' => :optional
depends_on 'glib'
depends_on :python => :recommended
depends_on :python3 => :optional
depends_on 'py2cairo' if build.with? 'python'
depends_on 'py3cairo' if build.with? 'python3'
depends_on 'gobject-introspection'
option :universal
def patches
"https://gist.github.com/krrk/6439665/raw/a527e14cd3a77c19b089f27bea884ce46c988f55/pygobject-fix-module.patch" if build.with? 'tests'
end
def install
ENV.universal_binary if build.universal?
2014-01-04 13:13:49 +00:00
if build.with? 'tests'
# autogen.sh is necessary to update the build system after the above
# patch and XDG_DATA_DIRS needs to be fixed for some tests to run
inreplace 'tests/Makefile.am', '/usr/share', HOMEBREW_PREFIX/'share'
system "./autogen.sh"
end
2014-01-04 13:13:49 +00:00
2014-03-08 12:08:10 +00:00
Language::Python.each_python(build) do |python, version|
2014-02-27 04:32:22 +00:00
ENV["PYTHON"] = "#{python}" if Formula[python].installed?
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make", "install"
system "make", "check" if build.with? 'tests'
2014-03-08 12:08:10 +00:00
system "make", "clean"
end
end
test do
Pathname('test.py').write <<-EOS.undent
import gi
assert("__init__" in gi.__file__)
EOS
2014-03-08 12:08:10 +00:00
Language::Python.each_python(build) do |python, version|
system python, "test.py"
end
end
end