Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/pycoverage/__main__.py

Issue 727003004: Add python coverage module to third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pycoverage/README.txt ('k') | third_party/pycoverage/coverage/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « third_party/pycoverage/README.txt ('k') | third_party/pycoverage/coverage/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698