Re: [gtk-osx-users] bundling with python3 and pygobject




On Aug 8, 2015, at 6:18 AM, Ben Letham <bletham gmail com> wrote:

Hi,

I have an open source project that is written in Python with GTK. I am in the process of converting from Python 2.7 / PyGTK to Python 3 / GTK3 / PyGObject, due to PyGTK being deprecated and not working in OSX10.10. Everything works in linux (my comfort zone) and windows, but I'm really struggling in osx.

I followed the directions here to set up jhbuild:

I was able to install the modules given in those instructions (like meta-gtk-osx-python-gtk3).

For the bundling (https://wiki.gnome.org/Projects/GTK%2B/OSX/Bundling) my .bundle file has:

<binary dest="${bundle}/Contents/MacOS">
    ${prefix}/bin/python3
</binary>

In order to get python3 into ${prefix}/bin/python3 my understanding is that I need to run
jhbuild build python3

When I run this, the build process errors with:

DYLD_LIBRARY_PATH=/Users/stewarthamblin/gtk/source/Python-3.4.3 ./python.exe -E -S -m sysconfig --generate-posix-vars ;\
    if test $? -ne 0 ; then \
        echo "generate-posix-vars failed" ; \
        rm -f ./pybuilddir.txt ; \
        exit 1 ; \
    fi
/bin/sh: line 1:  3587 Killed: 9               DYLD_LIBRARY_PATH=/Users/stewarthamblin/gtk/source/Python-3.4.3 ./python.exe -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1
*** Error during phase build of python3: ########## Error running make -j 2 *** [3/3]


I did previously run
jhbuild build python

which installed python2.7, successfully. It created ${prefix}/bin/python2. I had thought that maybe there was some conflict in having installed this first, so I did run jhbuild uninstall python and jhbuild clean python, both of which ran without error but did not resolve the issue with installing python3.

Has anyone successfully bundled an app with Python 3 and GTK3? The examples with gtk-mac-bundler have a PyGTK example and a GTK3 example, but nothing with Python 3 and PyGObject. I'm not very familiar with Gtk or OSX, so any help would be greatly appreciated.

Bundling is easy, the bundler runs under both Py2 and Py3. Building is a PITA because gobject-introspection works only with Py3. What I do with Gramps is to make a meta-module with the introspected dependencies and another with the dependencies requiring Py3. I build Py2 and the first meta module, then build Py3 and link $PREFIX/bin/python and $PREFIX/bin/python-config to the Py3 executables, then build the second meta-module and Gramps itself. Once that’s done gtk-mac-bundler makes the bundle as usual.

Regards,
John Ralls




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]