コード例 #1
0
GLib 2.42.2, PyGObject 3.14.0, and GObject Introspection 1.42 on Windows 7
"""

import glob
import os
import sys

import PyInstaller.log as logging
from PyInstaller.compat import is_darwin, is_win, is_linux, base_prefix
from PyInstaller.utils.hooks import get_gi_typelibs, get_gi_libdir, exec_statement

logger = logging.getLogger(__name__)

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

libdir = get_gi_libdir('Gio', '2.0')
path = None

if is_win:
    pattern = os.path.join(libdir, 'gio', 'modules', '*.dll')
elif is_darwin or is_linux:
    gio_libdir = os.path.join(libdir, 'gio', 'modules')
    if not os.path.exists(gio_libdir):
        # homebrew installs the files elsewhere..
        gio_libdir = os.path.join(os.path.commonprefix([base_prefix, gio_libdir]), 'lib', 'gio', 'modules')

    pattern = os.path.join(gio_libdir, '*.so')

if pattern:
    for f in glob.glob(pattern):
        binaries.append((f, 'gio_modules'))
コード例 #2
0
from PyInstaller.compat import (exec_command_stdout, is_darwin, is_win,
                                is_linux, open_file, which)
from PyInstaller.utils.hooks import (collect_glib_translations,
                                     get_gi_typelibs, get_gi_libdir, logger)

# If the "gdk-pixbuf-query-loaders" command is not in the current ${PATH}, GDK
# and thus GdkPixbuf is unavailable. Return with a non-fatal warning.
if which('gdk-pixbuf-query-loaders') is None:
    logger.warn('"hook-gi.repository.GdkPixbuf" ignored, since GDK not found '
                '(i.e., "gdk-pixbuf-query-loaders" not in $PATH).')
# Else, GDK is available. Let's do this.
else:
    binaries, datas, hiddenimports = get_gi_typelibs('GdkPixbuf', '2.0')
    datas += collect_glib_translations('gdk-pixbuf')

    libdir = get_gi_libdir('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:
        pattern = os.path.join(libdir, 'gdk-pixbuf-2.0', '2.10.0', 'loaders',
                               '*.dll')
    elif is_darwin or is_linux:
        pattern = os.path.join(libdir, 'gdk-pixbuf-2.0', '2.10.0', 'loaders',
                               '*.so')

    # If loader detection is supported on this platform, bundle all detected
    # loaders and an updated loader cache.
    if pattern:
        # Bundle all found loaders with this user application.
        for f in glob.glob(pattern):
コード例 #3
0
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 not found '
        '(i.e., "gdk-pixbuf-query-loaders" not in $PATH).'
    )
# Else, GDK is available. Let's do this.
else:
    binaries, datas, hiddenimports = get_gi_typelibs('GdkPixbuf', '2.0')
    datas += collect_glib_translations('gdk-pixbuf')

    libdir = get_gi_libdir('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:
        pattern = os.path.join(
            libdir, 'gdk-pixbuf-2.0', '2.10.0', 'loaders', '*.dll')
    elif is_darwin or is_linux:
        pattern = os.path.join(
            libdir, 'gdk-pixbuf-2.0', '2.10.0', 'loaders', '*.so')

    # If loader detection is supported on this platform, bundle all detected
    # loaders and an updated loader cache.
    if pattern:
        loader_libs = []
コード例 #4
0
# 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 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
"""

import os
import glob

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

binaries, datas, hiddenimports = get_gi_typelibs('GLib', '2.0')
datas += collect_glib_translations('glib20')
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')
    pattern = os.path.join(libdir, 'gspawn-*-helper*.exe')
    for f in glob.glob(pattern):
        binaries.append((f, '.'))