File: __main__.py

package info (click to toggle)
python-coverage 3.7.1%2Bdfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,808 kB
  • ctags: 1,522
  • sloc: python: 10,533; ansic: 530; makefile: 172; sh: 124; xml: 59
file content (15 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""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)