Exemplo n.º 1
0
def freeze(debug=False):
    """
    Compile your code to a standalone executable
    """
    require_existing_project()
    if not _has_module('PyInstaller'):
        raise FbsError("Could not find PyInstaller. Maybe you need to:\n"
                       "    pip install PyInstaller==3.4")
    # Import respective functions late to avoid circular import
    # fbs <-> fbs.freeze.X.
    app_name = SETTINGS['app_name']
    if is_mac():
        from fbs.freeze.mac import freeze_mac
        freeze_mac(debug=debug)
        executable = 'target/%s.app/Contents/MacOS/%s' % (app_name, app_name)
    else:
        executable = join('target', app_name, app_name)
        if is_windows():
            from fbs.freeze.windows import freeze_windows
            freeze_windows(debug=debug)
            executable += '.exe'
        elif is_linux():
            if is_ubuntu():
                from fbs.freeze.ubuntu import freeze_ubuntu
                freeze_ubuntu(debug=debug)
            elif is_arch_linux():
                from fbs.freeze.arch import freeze_arch
                freeze_arch(debug=debug)
            elif is_fedora():
                from fbs.freeze.fedora import freeze_fedora
                freeze_fedora(debug=debug)
            else:
                from fbs.freeze.linux import freeze_linux
                freeze_linux(debug=debug)
        else:
            raise FbsError('Unsupported OS')
    _LOG.info(
        "Done. You can now run `%s`. If that doesn't work, see "
        "https://build-system.fman.io/troubleshooting.", executable)
Exemplo n.º 2
0
def freeze_ubuntu(debug=False):
    freeze_linux(debug)
    # When we build on Ubuntu on 14.04 and run on 17.10, the app fails to start
    # with the following error:
    #
    #  > This application failed to start because it could not find or load the
    #  > Qt platform plugin "xcb" in "". Available platform plugins are:
    #  > eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
    #
    # Interestingly, the error does not occur when building on Ubuntu 16.04.
    # The difference between the two build outputs seems to be
    # libgpg-error.so.0. Removing it fixes the problem:
    remove_shared_libraries('libgpg-error.so.*')
    # libgtk-3.so is present on every Ubuntu system. Make sure we don't ship it
    # to avoid incompatibilities. In particular, running the frozen app with
    # libgtk-3.so from Ubuntu 14 on Ubuntu 16 produces many Gtk warnings
    # "Theme parsing error".
    remove_shared_libraries('libgtk-3.so.*')
    # We also don't want to ship libgio-2.0.so because it is usually present.
    # What's more, if we ship libgio without libgtk, then segmentation faults
    # occur when freezing on Ubuntu 14 and running on Ubuntu 16. The reason for
    # this is that libgio depends on libgtk. Because we don't ship libgtk, this
    # loads the user's libgtk, which is incompatible between Ubuntu 14 and 16.
    remove_shared_libraries('libgio-2.0.so.*')
Exemplo n.º 3
0
def freeze_fedora(extra_pyinstaller_args=None, debug=False):
    freeze_linux(extra_pyinstaller_args, debug)
    # Force Fedora to use the system's Gnome libraries. This avoids warnings
    # when starting the app on the command line.
    remove_shared_libraries('libgio-2.0.so.*', 'libglib-2.0.so.*')
Exemplo n.º 4
0
def freeze_arch(extra_pyinstaller_args=None, debug=False):
    freeze_linux(extra_pyinstaller_args, debug)
Exemplo n.º 5
0
def freeze_arch(debug=False):
    freeze_linux(debug)