gst-python: also provide python 3 overrides

Closes #596.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
master
Alexandru Băluț 2016-04-19 16:40:26 +02:00 committed by Martin Afanasjew
parent 743647f289
commit aa55ea5f5a
1 changed files with 35 additions and 7 deletions

View File

@ -10,21 +10,49 @@ class GstPython < Formula
sha256 "e708aa675d5744fc36608249728290d6d97803cd071bf2ac91d245a9d8e8c996" => :mavericks
end
option "without-python", "Build without python 2 support"
depends_on :python3 => :optional
depends_on "gst-plugins-base"
depends_on "pygobject3"
if build.with? "python"
depends_on "pygobject3"
end
if build.with? "python3"
depends_on "pygobject3" => "with-python3"
end
link_overwrite "lib/python2.7/site-packages/gi/overrides"
def install
# pygi-overrides-dir switch ensures files don't break out of sandbox.
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--with-pygi-overrides-dir=#{lib}/python2.7/site-packages/gi/overrides"
system "make", "install"
if build.with?("python") && build.with?("python3")
# Upstream does not support having both Python2 and Python3 versions
# of the plugin installed because apparently you can load only one
# per process, so GStreamer does not know which to load.
odie "Options --with-python and --with-python3 are mutually exclusive."
end
Language::Python.each_python(build) do |python, version|
# pygi-overrides-dir switch ensures files don't break out of sandbox.
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--with-pygi-overrides-dir=#{lib}/python#{version}/site-packages/gi/overrides",
"PYTHON=#{python}"
system "make", "install"
end
end
test do
system "#{Formula["gstreamer"].opt_bin}/gst-inspect-1.0", "python"
Language::Python.each_python(build) do |python, _version|
# Without gst-python raises "TypeError: object() takes no parameters"
system python, "-c", <<-EOS.undent
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
print (Gst.Fraction(num=3, denom=5))
EOS
end
end
end