Exemplo n.º 1
0
def setup_installation():
    """Install necessary GUI resources

    By default, RAFCON should be installed via `pip` (`pip install rafcon`). With this, all resources are being
    installed. If installed in a virtual env, some locally required files need to be reinstalled into $XTG_DATA_HOME.

    If RAFCON is started directly from the repo or from RMPM (without a previous installation), it can be forced to
    install all additionally required files (icons and gtksourceview styles) by setting the env variable
    `RAFCON_CHECK_INSTALLATION` to "True". If `RAFCON_CHECK_INSTALLATION` is set to "False", it will prevent a restart
    of RAFCON e.g. after updating the font cache.
    """
    force_check_installation = os.environ.get("RAFCON_CHECK_INSTALLATION",
                                              False) == "True"
    prevent_restart = os.environ.get("RAFCON_CHECK_INSTALLATION",
                                     True) == "False"

    if not force_check_installation and data_files_version_up_to_date():
        return

    if force_check_installation or installation.started_without_installation(
    ) or installation.started_in_virtualenv():
        installation.install_locally_required_files()

    installation.install_fonts(restart=(not prevent_restart))

    update_data_files_version()
Exemplo n.º 2
0
def setup_installation():
    """Install necessary GUI resources
    
    By default, RAFCON should be installed via `setup.py` (`pip install rafcon`). Thereby, all resources are being 
    installed. However, if this is not the case, one can set the `RAFCON_CHECK_INSTALLATION` env variable to `True`. 
    Then, the installation will be performed before starting the GUI. 
    """
    if os.environ.get("RAFCON_CHECK_INSTALLATION", False) == "True":
        rafcon_root = os.path.dirname(rafcon.__file__)
        installation.assets_folder = os.path.join(rafcon_root, 'gui', 'assets')
        installation.share_folder = os.path.join(
            os.path.dirname(os.path.dirname(rafcon_root)), 'share')
        installation.install_fonts(logger, restart=True)
        installation.install_gtk_source_view_styles(logger)
        installation.install_libraries(logger, overwrite=False)