How to use the fbs.cmdline.command 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 dnkorpushov / libro / build.py View on Github external
@command
def locale():
    for pro_file in glob('*.pro'):
        call('pylupdate5 -translate-function _tr {}'.format(pro_file), shell=True)

    for ts_file in glob(os.path.join(LOCALE_SRCPATH, '*.ts')):
        dst_file = os.path.join(LOCALE_DSTPATH, os.path.splitext(os.path.split(ts_file)[1])[0] + '.qm')
        call('lrelease {} -qm {}'.format(ts_file, dst_file), shell=True)
github dnkorpushov / libro / build.py View on Github external
@command
def ui():
    for ui_file in glob(os.path.join(UI_SRCPATH, '*.ui')):
        py_file = os.path.join(UI_DESTPATH, os.path.splitext(os.path.split(ui_file)[1])[0] + '_ui.py')
        ui_file = os.path.normpath(ui_file)
        py_file = os.path.normpath(py_file)
        call('pyuic5 --from-imports {} -o {}'.format(ui_file, py_file), shell=True)
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def startproject():
    """
    Start a new fbs project in the current directory
    """
    if exists('src'):
        _LOG.warning('The src/ directory already exists. Aborting.')
        return
    try:
        app = _prompt_for_value('App name [MyApp] : ', default='MyApp')
        user = getuser().title()
        author = _prompt_for_value('Author [%s] : ' % user, default=user)
        version = \
            _prompt_for_value('Initial version [0.0.1] : ', default='0.0.1')
        eg_bundle_id = 'com.%s.%s' % (
            author.lower().split()[0], ''.join(app.lower().split())
        )
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def test():
    """
    Execute your automated tests
    """
    sys.path.append(path('src/main/python'))
    suite = TestSuite()
    test_dirs = SETTINGS['test_dirs']
    for test_dir in map(path, test_dirs):
        sys.path.append(test_dir)
        try:
            dir_names = listdir(test_dir)
        except FileNotFoundError:
            continue
        for dir_name in dir_names:
            dir_path = join(test_dir, dir_name)
            if isfile(join(dir_path, '__init__.py')):
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def freeze(debug=False):
    """
    Compile your application to a standalone executable
    """
    try:
        rmtree(path('${freeze_dir}'))
    except FileNotFoundError:
        pass
    # 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:
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def startproject():
    """
    Start a new project in the current directory
    """
    if exists('src'):
        raise FbsError('The src/ directory already exists. Aborting.')
    app = prompt_for_value('App name', default='MyApp')
    user = getuser().title()
    author = prompt_for_value('Author', default=user)
    has_pyqt = _has_module('PyQt5')
    has_pyside = _has_module('PySide2')
    if has_pyqt and not has_pyside:
        python_bindings = 'PyQt5'
    elif not has_pyqt and has_pyside:
        python_bindings = 'PySide2'
    else:
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def sign_installer():
    """
    Sign installer, so the user's OS trusts it
    """
    if is_mac():
        _LOG.info('fbs does not yet implement `sign_installer` on macOS.')
        return
    if is_ubuntu():
        _LOG.info('Ubuntu does not support signing installers.')
        return
    require_installer()
    if is_windows():
        from fbs.sign_installer.windows import sign_installer_windows
        sign_installer_windows()
    elif is_arch_linux():
        from fbs.sign_installer.arch import sign_installer_arch
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def clean():
    """
    Remove previous build outputs
    """
    try:
        rmtree(path('target'))
    except FileNotFoundError:
        return
    except OSError:
        # In a docker container, target/ may be mounted so we can't delete it.
        # Delete its contents instead:
        for f in listdir(path('target')):
            fpath = join(path('target'), f)
            if isdir(fpath):
                rmtree(fpath, ignore_errors=True)
            elif isfile(fpath):
github mherrmann / fbs / fbs / builtin_commands / _account.py View on Github external
@command
def login():
    """
    Save your account details to secret.json
    """
    require_existing_project()
    username = prompt_for_value('Username')
    password = prompt_for_value('Password', password=True)
    print('')
    _login(username, password)
github mherrmann / fbs / fbs / builtin_commands / __init__.py View on Github external
@command
def release():
    """
    Bump version and run clean,freeze,...,upload
    """
    require_existing_project()
    version = SETTINGS['version']
    next_version = _get_next_version(version)
    release_version = prompt_for_value('Release version', default=next_version)
    activate_profile('release')
    SETTINGS['version'] = release_version
    log_level = _LOG.level
    if log_level == logging.NOTSET:
        _LOG.setLevel(logging.WARNING)
    try:
        clean()
        freeze()