D7017: lsprof: remove __main__ functionality

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Oct 7 20:08:21 UTC 2019


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

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()



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


More information about the Mercurial-devel mailing list