homebrew-core/Formula/pygobject3.rb

51 lines
1.6 KiB
Ruby

class Pygobject3 < Formula
desc "GNOME Python bindings (based on GObject Introspection)"
homepage "https://wiki.gnome.org/Projects/PyGObject"
url "https://download.gnome.org/sources/pygobject/3.38/pygobject-3.38.0.tar.xz"
sha256 "0372d1bb9122fc19f500a249b1f38c2bb67485000f5887497b4b205b3e7084d5"
license "LGPL-2.1-or-later"
livecheck do
url :stable
end
bottle do
cellar :any
sha256 "3b8a6b54d626f8fb57b28ac43f21b1ba7fc528701487ba7be9d1e7c3f7ed7ae6" => :catalina
sha256 "629f3c862dddd99522e79bd33fc0931c6c93cef41806c14a55d893de3b8469a7" => :mojave
sha256 "21348f74c4a9be8c3cf3ef74c25d2907aeb48b77459cdcbbdb086e4b1946cfb3" => :high_sierra
end
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "gobject-introspection"
depends_on "py3cairo"
depends_on "python@3.8"
def install
mkdir "buildpy3" do
system "meson", *std_meson_args,
"-Dpycairo=enabled",
"-Dpython=#{Formula["python@3.8"].opt_bin}/python3",
".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
test do
Pathname("test.py").write <<~EOS
import gi
gi.require_version("GLib", "2.0")
assert("__init__" in gi.__file__)
from gi.repository import GLib
assert(31 == GLib.Date.get_days_in_month(GLib.DateMonth.JANUARY, 2000))
EOS
pyversion = Language::Python.major_minor_version Formula["python@3.8"].opt_bin/"python3"
ENV.prepend_path "PYTHONPATH", lib/"python#{pyversion}/site-packages"
system Formula["python@3.8"].opt_bin/"python3", "test.py"
end
end