コード例 #1
0
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()
        installer()
        sign_installer()
        repo()
    finally:
        _LOG.setLevel(log_level)
    upload()
    base_json = 'src/build/settings/base.json'
    update_json(path(base_json), {'version': release_version})
    _LOG.info('Also, %s was updated with the new version.', base_json)
コード例 #2
0
ファイル: __init__.py プロジェクト: abhiraj2/khdownloader
def release(version=None):
    """
    Bump version and run clean,freeze,...,upload
    """
    require_existing_project()
    if version is None:
        curr_version = SETTINGS['version']
        next_version = _get_next_version(curr_version)
        release_version = prompt_for_value('Release version',
                                           default=next_version)
    elif version == 'current':
        release_version = SETTINGS['version']
    else:
        release_version = version
    activate_profile('release')
    SETTINGS['version'] = release_version
    log_level = _LOG.level
    if log_level == logging.NOTSET:
        _LOG.setLevel(logging.WARNING)
    try:
        clean()
        freeze()
        if is_windows() and _has_windows_codesigning_certificate():
            sign()
        installer()
        if (is_windows() and _has_windows_codesigning_certificate()) or \
            is_arch_linux() or is_fedora():
            sign_installer()
        repo()
    finally:
        _LOG.setLevel(log_level)
    upload()
    base_json = 'src/build/settings/base.json'
    update_json(path(base_json), {'version': release_version})
    _LOG.info('Also, %s was updated with the new version.', base_json)
コード例 #3
0
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:
        python_bindings = prompt_for_value(
            'Qt bindings', choices=('PyQt5', 'PySide2'), default='PyQt5'
        )
    eg_bundle_id = 'com.%s.%s' % (
        author.lower().split()[0], ''.join(app.lower().split())
    )
    mac_bundle_identifier = prompt_for_value(
        'Mac bundle identifier (eg. %s, optional)' % eg_bundle_id,
        optional=True
    )
    mkdir('src')
    template_dir = join(dirname(__file__), 'project_template')
    template_path = lambda relpath: join(template_dir, *relpath.split('/'))
    copy_with_filtering(
        template_dir, '.', {
            'app_name': app,
            'author': author,
            'mac_bundle_identifier': mac_bundle_identifier,
            'python_bindings': python_bindings
        },
        files_to_filter=[
            template_path('src/build/settings/base.json'),
            template_path('src/build/settings/mac.json'),
            template_path('src/main/python/main.py')
        ]
    )
    print('')
    _LOG.info(
        "Created the src/ directory. If you have %s installed, you can now "
        "do:\n\n    fbs run", python_bindings
    )
コード例 #4
0
def gengpgkey():
    """
    Generate a GPG key for Linux code signing
    """
    require_existing_project()
    if exists(_DEST_DIR):
        raise FbsError('The %s folder already exists. Aborting.' % _DEST_DIR)
    try:
        email = prompt_for_value('Email address')
        name = prompt_for_value('Real name', default=SETTINGS['author'])
        passphrase = prompt_for_value('Key password', password=True)
    except KeyboardInterrupt:
        print('')
        return
    print('')
    _LOG.info('Generating the GPG key. This can take a little...')
    _init_docker()
    args = ['run', '-t']
    if exists('/dev/urandom'):
        # Give the key generator more entropy on Posix:
        args.extend(['-v', '/dev/urandom:/dev/random'])
    args.extend([_DOCKER_IMAGE, '/root/genkey.sh', name, email, passphrase])
    result = _run_docker(args,
                         check=True,
                         stdout=PIPE,
                         universal_newlines=True)
    key = _snip(
        result.stdout,
        "revocation certificate stored as '/root/.gnupg/openpgp-revocs.d/",
        ".rev'",
        include_bounds=False)
    pubkey = _snip(result.stdout, '-----BEGIN PGP PUBLIC KEY BLOCK-----\n',
                   '-----END PGP PUBLIC KEY BLOCK-----\n')
    privkey = _snip(result.stdout, '-----BEGIN PGP PRIVATE KEY BLOCK-----\n',
                    '-----END PGP PRIVATE KEY BLOCK-----\n')
    makedirs(path(_DEST_DIR), exist_ok=True)
    pubkey_dest = _DEST_DIR + '/' + _PUBKEY_NAME
    Path(path(pubkey_dest)).write_text(pubkey)
    Path(path(_DEST_DIR + '/' + _PRIVKEY_NAME)).write_text(privkey)
    update_json(path(BASE_JSON), {'gpg_key': key, 'gpg_name': name})
    update_json(path(SECRET_JSON), {'gpg_pass': passphrase})
    _LOG.info(
        'Done. Created %s and ...%s. Also updated %s and ...secret.json with '
        'the values you provided.', pubkey_dest, _PRIVKEY_NAME, BASE_JSON)
コード例 #5
0
def startproject():
    """
    Start a new project in the current directory
    """
    if exists('src'):
        raise FbsError('The src/ directory already exists. Aborting.')
    try:
        app = prompt_for_value('App name', default='MyApp')
        user = getuser().title()
        author = prompt_for_value('Author', default=user)
        version = prompt_for_value('Initial version', default='0.0.1')
        eg_bundle_id = 'com.%s.%s' % (author.lower().split()[0], ''.join(
            app.lower().split()))
        mac_bundle_identifier = prompt_for_value(
            'Mac bundle identifier (eg. %s, optional)' % eg_bundle_id,
            optional=True)
    except KeyboardInterrupt:
        print('')
        return
    print('')
    mkdir('src')
    template_dir = join(dirname(__file__), 'project_template')
    template_path = lambda relpath: join(template_dir, *relpath.split('/'))
    python_bindings = _get_python_bindings()
    copy_with_filtering(template_dir,
                        '.', {
                            'app_name': app,
                            'author': author,
                            'version': version,
                            'mac_bundle_identifier': mac_bundle_identifier,
                            'python_bindings': python_bindings
                        },
                        files_to_filter=[
                            template_path('src/build/settings/base.json'),
                            template_path('src/build/settings/mac.json'),
                            template_path('src/main/python/main.py')
                        ])
    _LOG.info(
        "Created the src/ directory. If you have %s installed, you can now "
        "do:\n    fbs run", python_bindings)
コード例 #6
0
ファイル: __init__.py プロジェクト: mherrmann/fbs
def release(version=None):
    """
    Bump version and run clean,freeze,...,upload
    """
    require_existing_project()
    if version is None:
        curr_version = SETTINGS['version']
        next_version = _get_next_version(curr_version)
        release_version = prompt_for_value('Release version',
                                           default=next_version)
    elif version == 'current':
        release_version = SETTINGS['version']
    else:
        release_version = version
    if not is_valid_version(release_version):
        if not is_valid_version(version):
            raise FbsError(
                'The release version of your app is invalid. It should be '
                'three\nnumbers separated by dots, such as "1.2.3". '
                'You have: "%s".' % release_version)
    activate_profile('release')
    SETTINGS['version'] = release_version
    log_level = _LOG.level
    if log_level == logging.NOTSET:
        _LOG.setLevel(logging.WARNING)
    try:
        clean()
        freeze()
        if is_windows() and _has_windows_codesigning_certificate():
            sign()
        installer()
        if (is_windows() and _has_windows_codesigning_certificate()) or \
            is_arch_linux() or is_fedora():
            sign_installer()
        if _repo_is_supported():
            repo()
    finally:
        _LOG.setLevel(log_level)
    upload()
    base_json = 'src/build/settings/base.json'
    update_json(path(base_json), {'version': release_version})
    _LOG.info('Also, %s was updated with the new version.', base_json)
コード例 #7
0
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')
    while ' ' in app:
        print('Sorry, spaces in the app name are not yet supported.')
        app = prompt_for_value('App name', default='MyApp')
    user = getuser().title()
    author = prompt_for_value('Author', default=user)
    python_bindings = prompt_for_value('Qt bindings (PyQt5 or PySide2)', default='PyQt5')
    while python_bindings.lower() not in ["pyqt5", "pyside2"]:
        print('Please select between "PyQt5" or "PySide2" only')
        python_bindings = prompt_for_value('Qt bindings (PyQt5 or PySide2)', default='PyQt5')
    eg_bundle_id = 'com.%s.%s' % (
        author.lower().split()[0], ''.join(app.lower().split())
    )
    mac_bundle_identifier = prompt_for_value(
        'Mac bundle identifier (eg. %s, optional)' % eg_bundle_id,
        optional=True
    )
    mkdir('src')
    template_dir = join(dirname(__file__), 'project_template')
    template_path = lambda relpath: join(template_dir, *relpath.split('/'))
    copy_with_filtering(
        template_dir, '.', {
            'app_name': app,
            'author': author,
            'mac_bundle_identifier': mac_bundle_identifier,
            'python_bindings': python_bindings
        },
        files_to_filter=[
            template_path('src/build/settings/base.json'),
            template_path('src/build/settings/mac.json'),
            template_path('src/main/python/main.py')
        ]
    )
    print('')
    _LOG.info(
        "Created the src/ directory. If you have %s installed, you can now "
        "do:\n\n    fbs run", python_bindings
    )