def _collect_tcl_modules(tcl_root):
    """
    Get a list of TOC-style 3-tuples describing Tcl modules. The modules
    directory is separate from the library/data one, and is located
    at $tcl_root/../tclX, where X is the major Tcl version.

    Returns
    -------
    Tree
        Such list, if the modules directory exists.
    """

    # Obtain Tcl major version.
    tcl_version = exec_statement(
        'from tkinter import Tcl; print(Tcl().eval("info tclversion"))')
    tcl_version = tcl_version.split('.')[0]

    modules_dirname = 'tcl' + str(tcl_version)
    modules_path = os.path.join(tcl_root, '..', modules_dirname)

    if not os.path.isdir(modules_path):
        logger.warn('Tcl modules directory %s does not exist.', modules_path)
        return []

    return Tree(modules_path, prefix=modules_dirname)
Exemple #2
0
    pyusb_backend_dir = set(dir(usb.backend))

    # perform find, which will load a usb library if found
    usb.core.find()

    # get the backend symbols which have been added (loaded)
    backends = set(dir(usb.backend)) - pyusb_backend_dir

    # for each of the loaded backends, see if they have a library
    binaries = []
    for usblib in [getattr(usb.backend, be)._lib for be in backends]:
        if usblib is not None:
            binaries = [(usblib._name, '')]

except (ValueError, usb.core.USBError) as exc:
    logger.warn("%s", exc)

# if nothing found, try to use our custom mechanism
if not binaries:
    # Try to resolve your libusb libraries in the following order:
    #
    #   libusb-1.0, libusb-0.1, openusb
    #
    # NOTE: Mind updating run-time hook when adding further libs.
    libusb_candidates = (
        # libusb10
        'usb-1.0',
        'usb',
        'libusb-1.0',
        # libusb01
        'usb-0.1',
import glob
import os
import subprocess

from PyInstaller.config import CONF
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(
Exemple #4
0
    pyusb_backend_dir = set(dir(usb.backend))

    # perform find, which will load a usb library if found
    usb.core.find()

    # get the backend symbols which have been added (loaded)
    backends = set(dir(usb.backend)) - pyusb_backend_dir

    # for each of the loaded backends, see if they have a library
    binaries = []
    for usblib in [getattr(usb.backend, be)._lib for be in backends]:
        if usblib is not None:
            binaries = [(usblib._name, '')]

except (ValueError, usb.core.USBError) as exc:
    logger.warn("%s", exc)


# if nothing found, try to use our custom mechanism
if not binaries:
    # Try to resolve your libusb libraries in the following order:
    #
    #   libusb-1.0, libusb-0.1, openusb
    #
    # NOTE: Mind updating run-time hook when adding further libs.
    libusb_candidates = (
        # libusb10
        'usb-1.0', 'usb', 'libusb-1.0',
        # libusb01
        'usb-0.1', 'libusb0',
        # openusb
Exemple #5
0
"""

import glob
import os
import subprocess

from PyInstaller.config import CONF
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')