diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index a60b69bf18..54f4e52f8c 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -1727,6 +1727,28 @@ plugins += [ if __name__ == '__main__': # Test load speed import subprocess, textwrap + try: + subprocess.check_call(['python', '-c', textwrap.dedent( + ''' + import init_calibre # noqa + + def doit(): + import calibre.customize.builtins as b # noqa + + def show_stats(): + from pstats import Stats + s = Stats('/tmp/calibre_stats') + s.sort_stats('cumulative') + s.print_stats(30) + + import cProfile + cProfile.run('doit()', '/tmp/calibre_stats') + show_stats() + + ''' + )]) + except subprocess.CalledProcessError: + raise SystemExit(1) try: subprocess.check_call(['python', '-c', textwrap.dedent( '''