#!/usr/bin/env python3
import os
import sys

__copyright__ = """
Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, see http://www.gnu.org/licenses/.
"""

if __name__ == '__main__':
    if sys.version_info[:2] < (3, 5):
        sys.stderr.write('StGit requires Python >= 3.5\n')
        sys.exit(1)

    if os.environ.get('COVERAGE_PROCESS_START'):
        import sys

        import coverage

        if len(sys.argv) < 2 or sys.argv[1].startswith('-'):
            context = 'stg'
        else:
            context = 'stg-' + sys.argv[1]

        cov = coverage.process_startup()
        cov.switch_context(context)

    from stgit.main import main

    main()
