diff options
Diffstat (limited to '__main__.py')
-rw-r--r-- | __main__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/__main__.py b/__main__.py new file mode 100644 index 00000000..7ad6d737 --- /dev/null +++ b/__main__.py @@ -0,0 +1,16 @@ +"""Be able to execute coverage.py by pointing Python at the repository's +directory.""" +import os +import runpy + + +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) |