Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

GObject introspection support #22314

Closed
wants to merge 13 commits into from

6 participants

@krrk

Here are a variety of patches adding gobject introspection support to a number of packages along with some version bumps. pygobject3 has been forked off from the pygobject formula, which will be retained to support the 2.0 series. While pygobject3 has a with-tests option to run the package's testsuite, this currently fails on my machine, hanging in test_tree_view (test_override_gtk.TestTreeView) with high CPU usage after most other tests have succeeded. Python 3 support would require py3cairo and can be added in the future. GObject Introspection is necessary for Gtk+3 python bindings and thus Gtk+3's dependencies (gdk-pixbuf, atk and pango) require gobject intorospection.

@jacknagel
Owner

Note, please don't update gnome software to x.{odd} versions, they are considered development releases.

@samueljohn

Glad someone tackles this! :+1: @krrk

@krrk

I have realized that to support pygobject3 for python 3 it would need to be a separate formula to have a separate name. In Debian the packages for python GObject bindings are as follows:

python-gobject: Python 2.x bindings for GObject - transitional package (version 3.x)
python-gobject-2: deprecated static Python bindings for the GObject library (version 2.x)
python3-gi: Python 3 bindings for gobject-introspection libraries (version 3.x)
python3-gi-cairo: Python 3 Cairo bindings for the GObject library (version 3.x)

I believe that python3-gi and python3-gi-cairo do not need to be separate and cairo support can be built along with gobject-introspection for the same build. I have prepared a formula for py3cairo to do this, but what would be the best naming convention for pygobject3 for python 2.x and pygobject3 for python 3.x?

@samueljohn

For pyqt and PySide I was able to create python bindings for 2.x and 3.x so we don't end up with all those -py3 and -py3 formulae.
I wrote a bit in the wiki about the python do ... end block to support such a thing.

@adamv
Owner

Can this be split into two (or more) pull requests? Some of these changes can possibly be pulled ahead of other ones.

@adamv
Owner

For instance, separate out a pull request that games gnome-common to 3.6.x

@krrk
@mikemcquaid
Owner

@BrewTestBot test this please

krrk added some commits
@krrk krrk gdk-pixbuf: Enable gobject introspection
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
899b1c7
@krrk krrk atk: Enable gobject introspection
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
3b27170
@krrk krrk gtk+3: Enable gobject introspection
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
df6a860
@krrk krrk pango: Enable gobject introspection
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
1652dd9
@krrk krrk gobject-introspection: Override GOBJECT_INTROSPECTION_LIBDIR
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
1ff4e1a
@krrk krrk gobject-introspection: Add optional tests
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
afbd4ea
@krrk krrk pygobject3: Add formula for 3.8.3
Due to the major bump, we have retained the pygobject 2.0 line.

Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
9afd706
@krrk krrk pygobject3: Add tests
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
d3db3cf
@krrk krrk pygobject3: Fix XDG_DATA_DIRS
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
651ad1b
@krrk krrk py3cairo: Add formula for py3cairo 1.10.0. This seems necessary as `p…
…ip3 install pycairo` failed to install. The name py3cairo matches what Debian uses but disagrees with the developers calling it pycairo; however, the pygobject and other projects look for py3cairo.

Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
db79bcb
@krrk

@mikemcquaid I have rebased this pull request on the up-to-date master to address the failed test build.
@adamv I have opened 5 new pull requests for prerequisites
@BrewTestBot test this please

@manphiz manphiz commented on the diff
Library/Formula/pango.rb
@@ -26,7 +27,6 @@ def install
--prefix=#{prefix}
--enable-man
--with-html-dir=#{share}/doc
- --disable-introspection
@manphiz Collaborator
manphiz added a note

Prefer to be explicit here with --enable-introspection=yes.

@krrk
krrk added a note

I have pushed a commit for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@manphiz manphiz commented on the diff
Library/Formula/gtk+3.rb
((5 lines not shown))
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-glibtest",
- "--disable-introspection",
@manphiz Collaborator
manphiz added a note

Prefer to be explicit here with --enable-introspection=yes.

@krrk
krrk added a note

I have pushed a commit for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Library/Formula/gobject-introspection.rb
((32 lines not shown))
- system "make install"
+ inreplace 'configure' do |s|
+ s.change_make_var! 'GOBJECT_INTROSPECTION_LIBDIR', HOMEBREW_PREFIX/'lib'
+ end
+
+ if build.with? 'tests'
+ system "./configure", "--disable-dependency-tracking",
+ "--prefix=#{prefix}",
+ "--with-cairo"
+ system "make install"
+ system "make check"
+ else
+ system "./configure", "--disable-dependency-tracking",
+ "--prefix=#{prefix}"
+ system "make install"
+ end
@jacknagel Owner

Instead of repeating this, use an array for the arguments and conditionally push "--with-cairo" onto the array:

args = %W[--disable-dependency-tracking --prefix=#{prefix}]
args << "--with-cairo" if build.with? 'tests'

system "./configure", *args
@krrk
krrk added a note

This is a very neat way of doing it! I've committed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@krrk krrk Clean up execution of --with-tests
Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
30ca847
@jacknagel jacknagel was assigned
@jacknagel
Owner

I applied the other outstanding pull requests. I am working on the cairo/tests patch for gobject-introspection; it doesn't apply cleanly anymore but I will fix it up locally.

What's left here is the new formulae for py3cairo and pygobject3: it would make review easier for these to be in separate pull requests with a single commit for each. Thanks!

@jacknagel jacknagel closed this
@SaveTheRbtz SaveTheRbtz referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@kjedamzik kjedamzik referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@sunliwen sunliwen referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@pborzenkov pborzenkov referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 13, 2013
  1. @krrk

    gdk-pixbuf: Enable gobject introspection

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  2. @krrk

    atk: Enable gobject introspection

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  3. @krrk

    gtk+3: Enable gobject introspection

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  4. @krrk

    pango: Enable gobject introspection

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  5. @krrk

    gobject-introspection: Override GOBJECT_INTROSPECTION_LIBDIR

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  6. @krrk

    gobject-introspection: Add optional tests

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  7. @krrk

    pygobject3: Add formula for 3.8.3

    krrk authored
    Due to the major bump, we have retained the pygobject 2.0 line.
    
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  8. @krrk

    pygobject3: Add tests

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  9. @krrk

    pygobject3: Fix XDG_DATA_DIRS

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  10. @krrk

    py3cairo: Add formula for py3cairo 1.10.0. This seems necessary as `p…

    krrk authored
    …ip3 install pycairo` failed to install. The name py3cairo matches what Debian uses but disagrees with the developers calling it pycairo; however, the pygobject and other projects look for py3cairo.
    
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
  11. @krrk
  12. @krrk

    gtk+3: Make '--enable-introspection=yes' explicit

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
Commits on Oct 16, 2013
  1. @krrk

    Clean up execution of --with-tests

    krrk authored
    Signed-off-by: Kieran Ramos <ramos.kieran@gmail.com>
This page is out of date. Refresh to see the latest.
View
3  Library/Formula/atk.rb
@@ -8,6 +8,7 @@ class Atk < Formula
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'glib'
+ depends_on 'gobject-introspection'
option :universal
@@ -15,7 +16,7 @@ def install
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
- "--enable-introspection=no"
+ "--enable-introspection=yes"
system "make"
system "make install"
end
View
3  Library/Formula/gdk-pixbuf.rb
@@ -13,6 +13,7 @@ class GdkPixbuf < Formula
depends_on 'jpeg'
depends_on 'libtiff'
depends_on :libpng
+ depends_on 'gobject-introspection'
# 'loaders.cache' must be writable by other packages
skip_clean 'lib/gdk-pixbuf-2.0'
@@ -23,7 +24,7 @@ def install
"--disable-maintainer-mode",
"--enable-debug=no",
"--prefix=#{prefix}",
- "--enable-introspection=no",
+ "--enable-introspection=yes",
"--disable-Bsymbolic",
"--without-gdiplus"
system "make"
View
31 Library/Formula/gobject-introspection.rb
@@ -6,21 +6,44 @@ class GobjectIntrospection < Formula
sha256 '3575e5d353c17a567fdf7ffaaa7aebe9347b5b0eee8e69d612ba56a9def67d73'
option :universal
+ option 'with-tests', 'run tests'
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'glib'
depends_on 'libffi'
+ if build.with? 'tests'
+ depends_on 'cairo'
+ depends_on :x11
+ end
+
# To avoid: ImportError: dlopen(./.libs/_giscanner.so, 2): Symbol not found: _PyList_Check
depends_on :python
+ if build.with? 'tests'
+ # Patch to fix `make check` for OS X, changes expected '.so' extension to '.dylib'
+ def patches
+ "https://gist.github.com/krrk/6958869/download"
+ end
+ end
+
def install
ENV.universal_binary if build.universal?
inreplace 'giscanner/transformer.py', '/usr/share', HOMEBREW_PREFIX/'share'
- system "./configure", "--disable-dependency-tracking",
- "--prefix=#{prefix}",
- # Tests require (at least) cairo, disable them.
- "--disable-tests"
+ inreplace 'configure' do |s|
+ s.change_make_var! 'GOBJECT_INTROSPECTION_LIBDIR', HOMEBREW_PREFIX/'lib'
+ end
+
+ args = %W[--disable-dependency-tracking --prefix=#{prefix}]
+ args << "--with-cairo" if build.with? 'tests'
+
+ system "./configure", *args
system "make install"
end
+
+ def caveats; <<-EOS.undent
+ To run tests install using '--with-tests' these tests require that you have cairo and XQuartz installed.
+ EOS
+ end
+
end
View
8 Library/Formula/gtk+3.rb
@@ -3,7 +3,7 @@
class Gtkx3 < Formula
homepage 'http://gtk.org/'
url 'http://ftp.gnome.org/pub/gnome/sources/gtk+/3.10/gtk+-3.10.1.tar.xz'
- sha1 '6840ce0c7180344b063147332d4bf515a79ccebf'
+ sha256 'c12e6897fb1ec8d8f1a6de6cd0ac1372fee6fd63ee3a5a63813dc5f3473e6ab8'
depends_on :x11 => '2.5' # needs XInput2, introduced in libXi 1.3
depends_on 'pkg-config' => :build
@@ -17,14 +17,16 @@ class Gtkx3 < Formula
depends_on 'jasper' => :optional
depends_on 'atk'
depends_on 'at-spi2-atk'
+ depends_on 'gobject-introspection'
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-glibtest",
- "--disable-introspection",
@manphiz Collaborator
manphiz added a note

Prefer to be explicit here with --enable-introspection=yes.

@krrk
krrk added a note

I have pushed a commit for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- "--enable-x11-backend"
+ "--enable-x11-backend",
+ "--enable-introspection=yes"
+
system "make install"
# Prevent a conflict between this and Gtk+2
mv bin/'gtk-update-icon-cache', bin/'gtk3-update-icon-cache'
View
3  Library/Formula/pango.rb
@@ -14,6 +14,7 @@ class Pango < Formula
depends_on 'harfbuzz'
depends_on 'fontconfig'
depends_on :x11 unless build.without? 'x'
+ depends_on 'gobject-introspection'
fails_with :llvm do
build 2326
@@ -26,7 +27,7 @@ def install
--prefix=#{prefix}
--enable-man
--with-html-dir=#{share}/doc
- --disable-introspection
@manphiz Collaborator
manphiz added a note

Prefer to be explicit here with --enable-introspection=yes.

@krrk
krrk added a note

I have pushed a commit for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ --enable-introspection=yes
]
if build.include? 'without-x'
View
25 Library/Formula/py3cairo.rb
@@ -0,0 +1,25 @@
+require 'formula'
+
+class Py3cairo < Formula
+ homepage 'http://cairographics.org/pycairo/'
+ url 'http://cairographics.org/releases/pycairo-1.10.0.tar.bz2'
+ sha1 'b4283aa1cc9aafd12fd72ad371303a486da1d014'
+
+ depends_on 'pkg-config' => :build
+ depends_on 'cairo'
+ depends_on :x11
+ depends_on :python3
+
+ def install
+ python3 do
+ ENV['PYTHON'] = "python3"
+ system "./waf", "configure", "--prefix=#{prefix}"
+ system "./waf", "build"
+ system "./waf", "install"
+ end
+ end
+
+ test do
+ system "python3", "-c", "import cairo; print(cairo.version)"
+ end
+end
View
54 Library/Formula/pygobject3.rb
@@ -0,0 +1,54 @@
+require 'formula'
+
+class Pygobject3 < Formula
+ homepage 'http://live.gnome.org/PyGObject'
+ url 'http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.8/pygobject-3.8.3.tar.xz'
+ sha256 '384b3e1b8d1e7c8796d7eb955380d62946dd0ed9c54ecf0817af2d6b254e082c'
+
+ option 'with-tests', 'run tests'
+
+ depends_on 'pkg-config' => :build
+ depends_on 'xz' => :build
+ if build.with? 'tests'
+ depends_on 'automake' => :build
+ depends_on 'autoconf' => :build
+ depends_on 'gnome-common' => :build
+ depends_on 'libtool' => :build
+ depends_on 'gtk+3' => :build
+ end
+ depends_on 'glib'
+ depends_on :python
+ depends_on 'py2cairo'
+ depends_on 'gobject-introspection'
+
+ option :universal
+
+ if build.with? 'tests'
+ def patches
+ # necessary for tests
+ "https://gist.github.com/krrk/6439665/download"
+ end
+ end
+
+ def install
+ ENV.universal_binary if build.universal?
+
+ python do
+ 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
+
+ system "./configure", "--disable-dependency-tracking",
+ "--prefix=#{prefix}"
+ system "make"
+ system "make install"
+ end
+
+ if build.with? 'tests'
+ system "make check"
+ end
+ end
+end
Something went wrong with that request. Please try again.