Patchwork D7017: lsprof: remove __main__ functionality

login
register
mail settings
Submitter phabricator
Date Oct. 7, 2019, 8:08 p.m.
Message ID <differential-rev-PHID-DREV-w7fvfewcst6vonrpuuzm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42072/
State Superseded
Headers show

Comments

phabricator - Oct. 7, 2019, 8:08 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm pretty sure nobody uses this. I noticed it because Python 3
  linting is complaining about execfile.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7017

AFFECTED FILES
  mercurial/lsprof.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/lsprof.py b/mercurial/lsprof.py
--- a/mercurial/lsprof.py
+++ b/mercurial/lsprof.py
@@ -143,16 +143,3 @@ 
         res = res.encode('latin-1')
 
     return res
-
-
-if __name__ == '__main__':
-    import os
-
-    sys.argv = sys.argv[1:]
-    if not sys.argv:
-        print(b"usage: lsprof.py <script> <arguments...>", file=sys.stderr)
-        sys.exit(2)
-    sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])))
-    stats = profile(execfile, sys.argv[0], globals(), locals())
-    stats.sort()
-    stats.pprint()