Skip to content

Commit 6a00eb7

Browse files
committed
first attempt to switch to entry_points
1 parent f8220c3 commit 6a00eb7

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

mprof renamed to mprof.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
import glob
42
import os
53
import os.path as osp
@@ -465,7 +463,7 @@ def xlim_type(value):
465463
help="Save plot to file instead of displaying it.")
466464
parser.add_argument("--window", "-w", dest="xlim", type=xlim_type,
467465
help="Plot a time-subset of the data. E.g. to plot between 0 and 20.5 seconds: --window 0,20.5")
468-
parser.add_argument("--backend",
466+
parser.add_argument("--backend",
469467
help="Specify the Matplotlib backend to use")
470468
parser.add_argument("profiles", nargs="*",
471469
help="profiles made by mprof run")
@@ -540,8 +538,7 @@ def xlim_type(value):
540538
else:
541539
pl.show()
542540

543-
544-
if __name__ == "__main__":
541+
def main():
545542
# Workaround for optparse limitation: insert -- before first negative
546543
# number found.
547544
negint = re.compile("-[0-9]+")
@@ -555,3 +552,6 @@ def xlim_type(value):
555552
"run": run_action,
556553
"plot": plot_action}
557554
actions[get_action()]()
555+
556+
if __name__ == "__main__":
557+
main()

setup.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import io
33
import re
4-
import sys
54
from setuptools import setup
65

76

@@ -40,10 +39,6 @@ def find_version(*file_paths):
4039
4140
"""
4241

43-
scripts = ['mprof']
44-
if sys.platform == "win32":
45-
scripts.append('mprof.bat')
46-
4742
setup(
4843
name='memory_profiler',
4944
description='A module for monitoring memory usage of a python program',
@@ -52,8 +47,10 @@ def find_version(*file_paths):
5247
author='Fabian Pedregosa',
5348
author_email='f@bianp.net',
5449
url='http://pypi.python.org/pypi/memory_profiler',
55-
py_modules=['memory_profiler'],
56-
scripts=scripts,
50+
py_modules=['memory_profiler', 'mprof'],
51+
entry_points={
52+
'console_scripts' : ['mprof:main'],
53+
},
5754
install_requires=['psutil'],
5855
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
5956
license='BSD'

0 commit comments

Comments
 (0)