Mercurial > hg
comparison mercurial/lsprof.py @ 43108:dc6d866b8cb8
lsprof: remove __main__ functionality
I'm pretty sure nobody uses this. I noticed it because Python 3
linting is complaining about execfile.
Differential Revision: https://phab.mercurial-scm.org/D7017
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 07 Oct 2019 10:28:32 -0400 |
parents | d783f945a701 |
children | 313e3a279828 |
comparison
equal
deleted
inserted
replaced
43107:5e9188f054d9 | 43108:dc6d866b8cb8 |
---|---|
141 | 141 |
142 if sys.version_info.major >= 3: | 142 if sys.version_info.major >= 3: |
143 res = res.encode('latin-1') | 143 res = res.encode('latin-1') |
144 | 144 |
145 return res | 145 return res |
146 | |
147 | |
148 if __name__ == '__main__': | |
149 import os | |
150 | |
151 sys.argv = sys.argv[1:] | |
152 if not sys.argv: | |
153 print(b"usage: lsprof.py <script> <arguments...>", file=sys.stderr) | |
154 sys.exit(2) | |
155 sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0]))) | |
156 stats = profile(execfile, sys.argv[0], globals(), locals()) | |
157 stats.sort() | |
158 stats.pprint() |