Esempio n. 1
0
def _find_tcl_tk(hook_api):
    """
    Get a platform-specific 2-tuple of the absolute paths of the top-level
    external data directories for both Tcl and Tk, respectively.

    Returns
    -------
    list
        2-tuple whose first element is the value of `${TCL_LIBRARY}` and whose
        second element is the value of `${TK_LIBRARY}`.
    """
    bins = selectImports(hook_api.__file__)

    if is_darwin:
        # _tkinter depends on system Tcl/Tk frameworks.
        # For example this is the case of Python from homebrew.
        if not bins:
            # 'hook_api.binaries' can't be used because on Mac OS X _tkinter.so
            # might depend on system Tcl/Tk frameworks and these are not
            # included in 'hook_api.binaries'.
            bins = getImports(hook_api.__file__)
            # Reformat data structure from
            #     set(['lib1', 'lib2', 'lib3'])
            # to
            #     [('Tcl', '/path/to/Tcl'), ('Tk', '/path/to/Tk')]
            mapping = {}
            for l in bins:
                mapping[os.path.basename(l)] = l
            bins = [
                ('Tcl', mapping['Tcl']),
                ('Tk', mapping['Tk']),
            ]

        # _tkinter depends on Tcl/Tk compiled as frameworks.
        path_to_tcl = bins[0][1]
        if 'Library/Frameworks' in path_to_tcl and 'Python' not in path_to_tcl:  # Edited: https://github.com/pyinstaller/pyinstaller/issues/3753#issuecomment-432464838
            tcl_tk = _find_tcl_tk_darwin_frameworks(bins)
        # Tcl/Tk compiled as on Linux other Unixes.
        # For example this is the case of Tcl/Tk from macports.
        else:
            tcl_tk = _find_tcl_tk_dir()

    else:
        tcl_tk = _find_tcl_tk_dir()

    return tcl_tk
Esempio n. 2
0
def _find_tcl_tk(hook_api):
    """
    Get a platform-specific 2-tuple of the absolute paths of the top-level
    external data directories for both Tcl and Tk, respectively.

    Returns
    -------
    list
        2-tuple whose first element is the value of `${TCL_LIBRARY}` and whose
        second element is the value of `${TK_LIBRARY}`.
    """
    bins = selectImports(hook_api.__file__)

    if is_darwin:
        # _tkinter depends on system Tcl/Tk frameworks.
        # For example this is the case of Python from homebrew.
        if not bins:
            # 'hook_api.binaries' can't be used because on Mac OS X _tkinter.so
            # might depend on system Tcl/Tk frameworks and these are not
            # included in 'hook_api.binaries'.
            bins = getImports(hook_api.__file__)
            # Reformat data structure from
            #     set(['lib1', 'lib2', 'lib3'])
            # to
            #     [('Tcl', '/path/to/Tcl'), ('Tk', '/path/to/Tk')]
            mapping = {}
            for l in bins:
                mapping[os.path.basename(l)] = l
            bins = [
                ('Tcl', mapping['Tcl']),
                ('Tk', mapping['Tk']),
            ]

        # _tkinter depends on Tcl/Tk compiled as frameworks.
        path_to_tcl = bins[0][1]
        if 'Library/Frameworks' in path_to_tcl:
            tcl_tk = _find_tcl_tk_darwin_frameworks(bins)
        # Tcl/Tk compiled as on Linux other Unixes.
        # For example this is the case of Tcl/Tk from macports.
        else:
            tcl_tk = _find_tcl_tk_dir()

    else:
        tcl_tk = _find_tcl_tk_dir()

    return tcl_tk
Esempio n. 3
0
def _find_gst_binaries():
    '''Returns a list of GStreamer plugins and libraries to pass as the
    ``binaries`` argument of ``Analysis``.
    '''
    gst_plugin_path = _find_gst_plugin_path()

    plugin_filepaths = []
    for plugin_dir in gst_plugin_path:
        plugin_filepaths.extend(glob.glob(os.path.join(plugin_dir, 'libgst*')))
    if len(plugin_filepaths) == 0:
        logging.warn('Could not find GStreamer plugins. ' +
                     'Possible solution: set GST_PLUGIN_PATH')
        return []

    lib_filepaths = set()
    for plugin_filepath in plugin_filepaths:
        plugin_deps = bindepend.selectImports(plugin_filepath)
        lib_filepaths.update([path for _, path in plugin_deps])

    plugin_binaries = [(f, 'gst-plugins') for f in plugin_filepaths]
    lib_binaries = [(f, '.') for f in lib_filepaths]

    return plugin_binaries + lib_binaries
Esempio n. 4
0
def _find_gst_binaries():
    '''Returns a list of GStreamer plugins and libraries to pass as the
    ``binaries`` argument of ``Analysis``.
    '''
    gst_plugin_path = _find_gst_plugin_path()

    plugin_filepaths = []
    for plugin_dir in gst_plugin_path:
        plugin_filepaths.extend(
            glob.glob(os.path.join(plugin_dir, 'libgst*')))
    if len(plugin_filepaths) == 0:
        logging.warn('Could not find GStreamer plugins. ' +
                     'Possible solution: set GST_PLUGIN_PATH')
        return []

    lib_filepaths = set()
    for plugin_filepath in plugin_filepaths:
        plugin_deps = bindepend.selectImports(plugin_filepath)
        lib_filepaths.update([path for _, path in plugin_deps])

    plugin_binaries = [(f, 'gst-plugins') for f in plugin_filepaths]
    lib_binaries = [(f, '.') for f in lib_filepaths]

    return plugin_binaries + lib_binaries
def _find_tcl_tk(hook_api):
    """
    Get a platform-specific 2-tuple of the absolute paths of the top-level
    external data directories for both Tcl and Tk, respectively.

    Returns
    -------
    list
        2-tuple whose first element is the value of `${TCL_LIBRARY}` and whose
        second element is the value of `${TK_LIBRARY}`.
    """
    bins = selectImports(hook_api.__file__)

    if is_darwin:
        # _tkinter depends on system Tcl/Tk frameworks.
        # For example this is the case of Python from homebrew.
        if not bins:
            # 'hook_api.binaries' can't be used because on Mac OS X _tkinter.so
            # might depend on system Tcl/Tk frameworks and these are not
            # included in 'hook_api.binaries'.
            bins = getImports(hook_api.__file__)

            if bins:
                # Reformat data structure from
                #     set(['lib1', 'lib2', 'lib3'])
                # to
                #     [('Tcl', '/path/to/Tcl'), ('Tk', '/path/to/Tk')]
                mapping = {}
                for lib in bins:
                    mapping[os.path.basename(lib)] = lib
                bins = [
                    ('Tcl', mapping['Tcl']),
                    ('Tk', mapping['Tk']),
                ]
            else:
                # Starting with macOS 11, system libraries are hidden.
                # Until we adjust library discovery accordingly, bins
                # will end up empty. But this implicitly indicates that
                # the system framework is used, so return None, None
                # to inform the caller.
                return None, None

        # _tkinter depends on Tcl/Tk compiled as frameworks.
        path_to_tcl = bins[0][1]
        # OS X system installation of Tcl/Tk.
        # [/System]/Library/Frameworks/Tcl.framework/Resources/Scripts/Tcl
        if 'Library/Frameworks/Tcl.framework' in path_to_tcl:
            #tcl_tk = _find_tcl_tk_darwin_system_frameworks(bins)
            tcl_tk = None, None  # Do not gather system framework's data

        # Tcl/Tk compiled as on Linux other Unixes.
        # This is the case of Tcl/Tk from macports and Tck/Tk built into
        # python.org OS X python distributions.
        # python.org built-in tcl/tk is located at
        # /Library/Frameworks/Python.framework/Versions/3.x/lib/libtcl8.6.dylib
        else:
            tcl_tk = _find_tcl_tk_dir()

    else:
        tcl_tk = _find_tcl_tk_dir()

    return tcl_tk