How to use the fbs._state.LOADED_PROFILES function in fbs

To help you get started, we’ve selected a few fbs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mherrmann / fbs / fbs / freeze / __init__.py View on Github external
def _generate_resources():
    """
    Copy the data files from src/main/resources to ${freeze_dir}.
    Automatically filters files mentioned in the setting files_to_filter:
    Placeholders such as ${app_name} are automatically replaced by the
    corresponding setting in files on that list.
    """
    freeze_dir = path('${freeze_dir}')
    if is_mac():
        resources_dest_dir = join(freeze_dir, 'Contents', 'Resources')
    else:
        resources_dest_dir = freeze_dir
    for path_fn in default_path, path:
        for profile in LOADED_PROFILES:
            _copy(path_fn, 'src/main/resources/' + profile, resources_dest_dir)
            _copy(path_fn, 'src/freeze/' + profile, freeze_dir)
github mherrmann / fbs / fbs / __init__.py View on Github external
def activate_profile(profile_name):
    """
    By default, fbs only loads some settings. For instance,
    src/build/settings/base.json and .../`os`.json where `os` is one of "mac",
    "linux" or "windows". This function lets you load other settings on the fly.
    A common example would be during a release, where release.json contains the
    production server URL instead of a staging server.
    """
    LOADED_PROFILES.append(profile_name)
    project_dir = SETTINGS['project_dir']
    json_paths = get_settings_paths(project_dir, LOADED_PROFILES)
    core_settings = get_core_settings(project_dir)
    SETTINGS.update(load_settings(json_paths, core_settings))
github mherrmann / fbs / fbs / __init__.py View on Github external
def activate_profile(profile_name):
    """
    By default, fbs only loads some settings. For instance,
    src/build/settings/base.json and .../`os`.json where `os` is one of "mac",
    "linux" or "windows". This function lets you load other settings on the fly.
    A common example would be during a release, where release.json contains the
    production server URL instead of a staging server.
    """
    LOADED_PROFILES.append(profile_name)
    project_dir = SETTINGS['project_dir']
    json_paths = get_settings_paths(project_dir, LOADED_PROFILES)
    core_settings = get_core_settings(project_dir)
    SETTINGS.update(load_settings(json_paths, core_settings))
github mherrmann / fbs / fbs / resources.py View on Github external
def get_icons():
    """
    Return a list [(size, scale, path)] of available app icons for the current
    platform.
    """
    result = {}
    for profile in LOADED_PROFILES:
        icons_dir = 'src/main/icons/' + profile
        for icon_path in glob(path(icons_dir + '/*.png')):
            name = splitext(basename(icon_path))[0]
            match = re.match('(\d+)(?:@(\d+)x)?', name)
            if not match:
                raise FbsError('Invalid icon name: ' + icon_path)
            size, scale = int(match.group(1)), int(match.group(2) or '1')
            result[(size, scale)] = icon_path
    return [(size, scale, path) for (size, scale), path in result.items()]