class Pygobject3 < Formula desc "GNOME Python bindings (based on GObject Introspection)" homepage "https://live.gnome.org/PyGObject" url "https://download.gnome.org/sources/pygobject/3.20/pygobject-3.20.1.tar.xz" sha256 "3d261005d6fed6a92ac4c25f283792552f7dad865d1b7e0c03c2b84c04dbd745" bottle do sha256 "69948257796089035e7f0ca55471290493831ffe88fee85b6ab8621c4b6957fb" => :el_capitan sha256 "11d9221d4dad4f2e7e01709892cb0b7f631087ecd37fae9d6d9cc80a0dbc417f" => :yosemite sha256 "9765c0bbd5a32d844764592b455e506bc60ffec2a59b6c0f79d945c7c231990f" => :mavericks end option :universal option "without-python", "Build without python2 support" depends_on "pkg-config" => :build depends_on "libffi" => :optional depends_on "glib" depends_on :python3 => :optional depends_on "py2cairo" if build.with? "python" depends_on "py3cairo" if build.with? "python3" depends_on "gobject-introspection" def install ENV.universal_binary if build.universal? Language::Python.each_python(build) do |python, _version| system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "PYTHON=#{python}" system "make", "install" system "make", "clean" end end test do Pathname("test.py").write <<-EOS.undent import gi assert("__init__" in gi.__file__) EOS Language::Python.each_python(build) do |python, _version| system python, "test.py" end end end