Skip to content

Commit 480ba0d

Browse files
author
Juan Luis Cano Rodríguez
authored
Merge pull request #172 from bernizt/master
Fix missing SIGKILL signal and mprof command in Windows
2 parents 6988f49 + a563dd0 commit 480ba0d

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

memory_profiler.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
import subprocess
1818
import logging
1919
import traceback
20-
from signal import SIGKILL
21-
20+
if sys.platform == "win32":
21+
# any value except signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT
22+
# can be used to kill a process unconditionally in Windows
23+
SIGKILL = -1
24+
else:
25+
from signal import SIGKILL
2226
import psutil
2327

2428

mprof.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
python %~dpn0 %*

setup.py

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

67

@@ -39,6 +40,10 @@ def find_version(*file_paths):
3940
4041
"""
4142

43+
scripts = ['mprof']
44+
if sys.platform == "win32":
45+
scripts.append('mprof.bat')
46+
4247
setup(
4348
name='memory_profiler',
4449
description='A module for monitoring memory usage of a python program',
@@ -48,7 +53,7 @@ def find_version(*file_paths):
4853
author_email='f@bianp.net',
4954
url='http://pypi.python.org/pypi/memory_profiler',
5055
py_modules=['memory_profiler'],
51-
scripts=['mprof'],
56+
scripts=scripts,
5257
install_requires=['psutil'],
5358
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
5459
license='BSD'

0 commit comments

Comments
 (0)