def hook(hook_api):
    module_versions = get_hook_config(hook_api, 'gi', 'module-versions')
    if module_versions:
        version = module_versions.get('GtkSource', '3.0')
    else:
        version = '3.0'
    logger.info(f'GtkSource version is {version}')

    binaries, datas, hiddenimports = get_gi_typelibs('GtkSource', version)

    datas += collect_glib_share_files(f'gtksourceview-{version}')
    hook_api.add_datas(datas)
    hook_api.add_binaries(binaries)
    hook_api.add_imports(*hiddenimports)
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject https://wiki.gnome.org/PyGObject
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('GIRepository', '2.0')
예제 #3
0
layer https://wiki.gnome.org/Projects/GObjectIntrospection

Tested with GStreamer 1.4.5, gst-python 1.4.0, PyGObject 3.16.2, and GObject Introspection 1.44.0 on Mac OS X 10.10 and
GStreamer 1.4.5, gst-python 1.4.0, PyGObject 3.14.0, and GObject Introspection 1.42 on Windows 7
"""

# GStreamer contains a lot of plugins. We need to collect them and bundle them wih the exe file.
# We also need to resolve binary dependencies of these GStreamer plugins.

import glob
import os
from PyInstaller.utils.hooks import exec_statement, get_hook_config
from PyInstaller.utils.hooks.gi import collect_glib_share_files, \
        collect_glib_translations, get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('Gst', '1.0')

datas += collect_glib_share_files('gstreamer-1.0')

hiddenimports += ["gi.repository.Gio"]


def hook(hook_api):
    hook_datas = []
    lang_list = get_hook_config(hook_api, "gi", "languages")

    for prog in [
            'gst-plugins-bad-1.0', 'gst-plugins-base-1.0',
            'gst-plugins-good-1.0', 'gst-plugins-ugly-1.0', 'gstreamer-1.0'
    ]:
        hook_datas += collect_glib_translations(prog, lang_list)
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject's "gi.repository.Champlain" package.
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('Champlain', '0.12')
예제 #5
0
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject https://wiki.gnome.org/PyGObject
"""

import os
import os.path
import glob

from PyInstaller.compat import is_win
from PyInstaller.utils.hooks import get_hook_config
from PyInstaller.utils.hooks.gi import collect_glib_share_files, \
        collect_glib_etc_files, collect_glib_translations, get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('Gtk', '3.0')

datas += collect_glib_share_files('fontconfig')


def hook(hook_api):
    hook_datas = []

    icon_list = get_hook_config(hook_api, "gi", "icons")
    theme_list = get_hook_config(hook_api, "gi", "themes")
    lang_list = get_hook_config(hook_api, "gi", "languages")

    if icon_list is not None:
        for icon in icon_list:
            hook_datas += collect_glib_share_files(os.path.join("icons", icon))
    else:
예제 #6
0
        'gdk-pixbuf-query-loaders',
    ]

    for cmd in cmds:
        gdk_pixbuf_query_loaders = which(cmd)
        if gdk_pixbuf_query_loaders is not None:
            break

    if gdk_pixbuf_query_loaders is None:
        logger.warning(
            '"hook-gi.repository.GdkPixbuf" ignored, since "gdk-pixbuf-query-loaders" is not in $PATH or gi lib dir.'
        )

    # Else, GDK is available. Let's do this.
    else:
        binaries, datas, hiddenimports = get_gi_typelibs('GdkPixbuf', '2.0')

        # To add support for a new platform, add a new "elif" branch below with the proper is_<platform>() test and glob
        # for finding loaders on that platform.
        if is_win:
            ext = "*.dll"
        elif is_darwin or is_linux:
            ext = "*.so"

        # If loader detection is supported on this platform, bundle all detected loaders and an updated loader cache.
        if ext:
            loader_libs = []

            # Bundle all found loaders with this user application.
            pattern = os.path.join(libdir, loaders_path, ext)
            for f in glob.glob(pattern):
PyGobject https://wiki.gnome.org/PyGObject via the GObject Introspection middleware layer
https://wiki.gnome.org/Projects/GObjectIntrospection

Tested with GLib 2.44.1, PyGObject 3.16.2, and GObject Introspection 1.44.0 on Mac OS 10.10 and
GLib 2.42.2, PyGObject 3.14.0, and GObject Introspection 1.42 on Windows 7.
"""

import glob
import os

from PyInstaller.compat import is_win
from PyInstaller.utils.hooks import get_hook_config
from PyInstaller.utils.hooks.gi import \
    collect_glib_share_files, collect_glib_translations, get_gi_libdir, get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('GLib', '2.0')


def hook(hook_api):
    hook_datas = []
    lang_list = get_hook_config(hook_api, "gi", "languages")

    hook_datas += collect_glib_translations('glib20', lang_list)
    hook_api.add_datas(hook_datas)


datas += collect_glib_share_files('glib-2.0', 'schemas')

# On Windows, glib needs a spawn helper for g_spawn* API
if is_win:
    libdir = get_gi_libdir('GLib', '2.0')
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject's "gi.repository.GtkClutter" package.
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('GtkClutter', '1.0')
예제 #9
0
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for GObject https://developer.gnome.org/gobject/stable/ from the GLib
library https://wiki.gnome.org/Projects/GLib introspected through PyGobject https://wiki.gnome.org/PyGObject
via the GObject Introspection middleware layer https://wiki.gnome.org/Projects/GObjectIntrospection

Tested with GLib 2.44.1, PyGObject 3.16.2, and GObject Introspection 1.44.0 on Mac OS X 10.10 and
GLib 2.42.2, PyGObject 3.14.0, and GObject Introspection 1.42 on Windows 7
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('GObject', '2.0')

hiddenimports += ['gi._gobject']
예제 #10
0
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject https://wiki.gnome.org/PyGObject
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('PangoCairo', '1.0')
예제 #11
0
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for GModule https://developer.gnome.org/glib/stable/glib-Dynamic-Loading-of-Modules.html from the GLib
library https://wiki.gnome.org/Projects/GLib introspected through PyGobject https://wiki.gnome.org/PyGObject
via the GObject Introspection middleware layer https://wiki.gnome.org/Projects/GObjectIntrospection

Tested with GLib 2.44.1, PyGObject 3.16.2, and GObject Introspection 1.44.0 on Mac OS 10.10 and
GLib 2.42.2, PyGObject 3.14.0, and GObject Introspection 1.42 on Windows 7.
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('GModule', '2.0')
예제 #12
0
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject https://wiki.gnome.org/PyGObject
"""

from PyInstaller.utils.hooks.gi import get_gi_typelibs

binaries, datas, hiddenimports = get_gi_typelibs('HarfBuzz', '0.0')
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
"""
Import hook for PyGObject https://wiki.gnome.org/PyGObject
"""

from PyInstaller.compat import is_darwin
from PyInstaller.utils.hooks.gi import get_gi_typelibs

if is_darwin:
    binaries, datas, hiddenimports = get_gi_typelibs('GtkosxApplication',
                                                     '1.0')