Esempio n. 1
0
def _on_level_init(map_name):
    """Called when a new map gets initialized."""
    OnLevelEnd._level_initialized = True

    # Don't check if it's an unversioned build (dev version)
    if is_unversioned():
        return

    if not _check_for_update.get_int():
        return

    try:
        latest_version = get_last_successful_build_number()
    except (URLError, socket.timeout):
        return

    if VERSION >= latest_version:
        return

    if _notify_on_update.get_int():
        # TODO: Add translations
        listeners_logger.log_warning(
            'A new Source.Python version is available!')

    on_version_update_listener_manager.notify(VERSION, latest_version)
Esempio n. 2
0
def _on_level_init(map_name):
    """Called when a new map gets initialized."""
    OnLevelEnd._level_initialized = True

    # Don't check if it's an unversioned build (dev version)
    if is_unversioned():
        return

    if not _check_for_update.get_int():
        return

    try:
        latest_version = get_last_successful_build_number()
    except (URLError, socket.timeout):
        return

    if VERSION >= latest_version:
        return

    if _notify_on_update.get_int():
        # TODO: Add translations
        listeners_logger.log_warning(
            'A new Source.Python version is available!')

    on_version_update_listener_manager.notify(VERSION, latest_version)
Esempio n. 3
0
def _build_source_python_docs():
    """Build Sphinx project files for Source.Python."""
    project = SphinxProject(SP_PACKAGES_PATH, SP_DOCS_PATH)
    if project.project_exists():
        # Update version and release
        conf_file = project.project_source_dir / 'conf.py'
        with conf_file.open() as f:
            lines = f.readlines()

        # Get the version string
        version = '' if is_unversioned() else f'v{VERSION}'

        with conf_file.open('w') as f:
            for line in lines:
                if line.startswith(('version', 'release')):
                    line = '{0} = \' {1}\'\n'.format(
                        line.split(maxsplit=1)[0], version)

                f.write(line)

        # Create/update credits.rst
        with project.project_source_dir.joinpath('general',
                                                 'credits.rst').open('w') as f:
            f.write(_get_updated_credits_wiki())

        try:
            project.build()
        except:
            logger.log_message('An error occured while building ' +
                               'project files for Source.Python.')
        else:
            logger.log_message(
                'Project files have been built for Source.Python.')
    else:
        logger.log_message('Sphinx project does not exist for Source.Python.')
def update_sp(info):
    """Update Source.Python to the latest version. A restart of the server is
    required.
    """
    if not is_unversioned() and VERSION >= get_last_successful_build_number():
        core_command_logger.log_message('No new version available.')
        return
        
    do_full_update()
Esempio n. 5
0
def update_sp(info):
    """Update Source.Python to the latest version. A restart of the server is
    required.
    """
    if not is_unversioned() and VERSION >= get_last_successful_build_number():
        core_command_logger.log_message('No new version available.')
        return

    do_full_update()
Esempio n. 6
0
def update_sp(info):
    """Update Source.Python to the latest version. A restart of the server is
    required.
    """
    if not is_unversioned() and VERSION >= get_last_successful_build_number():
        core_command_logger.log_message('No new version available.')
        return

    # Make sure there is a clean update directory
    clean_update_dir()
    try:
        download_latest_version()
        apply_update_stage1()
    except:
        # Make sure to leave a clean update directory, so the loader doesn't
        # get confused.
        clean_update_dir()
        raise
Esempio n. 7
0
def _on_level_init(map_name):
    """Called when a new map gets initialized."""
    if not _check_for_update.get_int():
        return

    try:
        update_available, version = is_newer_version_available()
    except (URLError, socket.timeout):
        return

    if not update_available:
        return

    if _notify_on_update.get_int():
        # TODO: Add translations
        listeners_logger.log_warning(
            'A new Source.Python version is available!')

    on_version_update_listener_manager.notify(VERSION, version,
                                              is_unversioned())
Esempio n. 8
0
def _on_level_init(map_name):
    """Called when a new map gets initialized."""
    if not _check_for_update.get_int():
        return

    try:
        update_available, version = is_newer_version_available()
    except (URLError, socket.timeout):
        return

    if not update_available:
        return

    if _notify_on_update.get_int():
        # TODO: Add translations
        listeners_logger.log_warning(
            'A new Source.Python version is available!')

    on_version_update_listener_manager.notify(
        VERSION, version, is_unversioned())
def _build_source_python_docs():
    """Build Sphinx project files for Source.Python."""
    project = SphinxProject(SP_PACKAGES_PATH, SP_DOCS_PATH)
    if project.project_exists():
        # Update version and release
        conf_file = project.project_source_dir / 'conf.py'
        with conf_file.open() as f:
            lines = f.readlines()

        # Get the version string
        version = '' if is_unversioned() else f'v{VERSION}'

        with conf_file.open('w') as f:
            for line in lines:
                if line.startswith(('version', 'release')):
                    line = '{0} = \' {1}\'\n'.format(
                        line.split(maxsplit=1)[0], version)

                f.write(line)

        # Create/update credits.rst
        with project.project_source_dir.joinpath(
                'general', 'credits.rst').open('w') as f:
            f.write(_get_updated_credits_wiki())

        try:
            project.build()
        except:
            logger.log_message(
                'An error occured while building ' +
                'project files for Source.Python.')
        else:
            logger.log_message(
                'Project files have been built for Source.Python.')
    else:
        logger.log_message(
            'Sphinx project does not exist for Source.Python.')