ltdconveyor/cli/upload.py
def _should_skip_travis_event(on_travis_push, on_travis_pr, on_travis_api,
                              on_travis_cron):
    """Detect if the upload should be skipped based on the
    ``TRAVIS_EVENT_TYPE`` environment variable.

    Returns
    -------
    should_skip : `bool`
        True if the upload should be skipped based on the combination of
        ``TRAVIS_EVENT_TYPE`` and user settings.
    """
    travis_event = os.getenv('TRAVIS_EVENT_TYPE')
    if travis_event is None:
        raise click.UsageError(
            'Using --travis but the TRAVIS_EVENT_TYPE '
            'environment variable is not detected.')

    if travis_event == 'push' and on_travis_push is False:
        click.echo('Skipping upload on Travis push event.')
        return True
    elif travis_event == 'pull_request' and on_travis_pr is False:
        click.echo('Skipping upload on Travis pull request event.')
        return True
    elif travis_event == 'api' and on_travis_api is False:
        click.echo('Skipping upload on Travis pull request event.')
        return True
    elif travis_event == 'cron' and on_travis_cron is False:
        click.echo('Skipping upload on Travis cron event.')
        return True
    else:
        return False
def _should_skip_travis_event(on_travis_push, on_travis_pr, on_travis_api,
                              on_travis_cron):
    """Detect if the upload should be skipped based on the
    ``TRAVIS_EVENT_TYPE`` environment variable.

    Returns
    -------
    should_skip : `bool`
        True if the upload should be skipped based on the combination of
        ``TRAVIS_EVENT_TYPE`` and user settings.
    """
    travis_event = os.getenv('TRAVIS_EVENT_TYPE')
    if travis_event is None:
        raise click.UsageError(
            'Using --travis but the TRAVIS_EVENT_TYPE '
            'environment variable is not detected.')

    if travis_event == 'push' and on_travis_push is False:
        click.echo('Skipping upload on Travis push event.')
        return True
    elif travis_event == 'pull_request' and on_travis_pr is False:
        click.echo('Skipping upload on Travis pull request event.')
        return True
    elif travis_event == 'api' and on_travis_api is False:
        click.echo('Skipping upload on Travis pull request event.')
        return True
    elif travis_event == 'cron' and on_travis_cron is False:
        click.echo('Skipping upload on Travis cron event.')
        return True
    else:
        return False
Detect if the upload should be skipped based on the
    ``TRAVIS_EVENT_TYPE`` environment variable.

    Returns
    -------
    should_skip : `bool`
        True if the upload should be skipped based on the combination of
        ``TRAVIS_EVENT_TYPE`` and user settings.