Index: third_party/pycoverage/__main__.py |
diff --git a/third_party/pycoverage/__main__.py b/third_party/pycoverage/__main__.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b11dafce6d551111e7bf5a807cb6037beb448cc6 |
--- /dev/null |
+++ b/third_party/pycoverage/__main__.py |
@@ -0,0 +1,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) |