File: __main__.py

package info (click to toggle)
python-coverage 4.2%2Bdfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,352 kB
  • ctags: 2,233
  • sloc: python: 16,048; ansic: 1,163; makefile: 184; sh: 162; xml: 42
file content (18 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt

"""Be able to execute coverage.py by pointing Python at a working tree."""

import runpy, os

PKG = 'coverage'

try:
    run_globals = runpy.run_module(PKG, run_name='__main__', alter_sys=True)
    executed = os.path.splitext(os.path.basename(run_globals['__file__']))[0]
    if executed != '__main__':  # For Python 2.5 compatibility
        raise ImportError(
            'Incorrectly executed %s instead of __main__' % executed
            )
except ImportError:  # For Python 2.6 compatibility
    runpy.run_module('%s.__main__' % PKG, run_name='__main__', alter_sys=True)