OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # $Id: setup.py 1142 2011-10-05 18:45:49Z g.rodola $ | 3 # $Id: setup.py 1189 2011-10-22 16:44:17Z g.rodola $ |
4 # | 4 # |
5 # Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved. | 5 # Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved. |
6 # Use of this source code is governed by a BSD-style license that can be | 6 # Use of this source code is governed by a BSD-style license that can be |
7 # found in the LICENSE file. | 7 # found in the LICENSE file. |
8 | 8 |
9 import sys | 9 import sys |
10 import os | 10 import os |
11 try: | 11 try: |
12 from setuptools import setup, Extension | 12 from setuptools import setup, Extension |
13 except ImportError: | 13 except ImportError: |
14 from distutils.core import setup, Extension | 14 from distutils.core import setup, Extension |
15 | 15 |
16 __ver__ = "0.3.1" | 16 __ver__ = "0.4.0" |
17 | 17 |
18 # Hack for Python 3 to tell distutils to run 2to3 against the files | 18 # Hack for Python 3 to tell distutils to run 2to3 against the files |
19 # copied in the build directory before installing. | 19 # copied in the build directory before installing. |
20 # Reference: http://docs.python.org/dev/howto/pyporting.html#during-installation | 20 # Reference: http://docs.python.org/dev/howto/pyporting.html#during-installation |
21 try: | 21 try: |
22 from distutils.command.build_py import build_py_2to3 as build_py | 22 from distutils.command.build_py import build_py_2to3 as build_py |
23 except ImportError: | 23 except ImportError: |
24 from distutils.command.build_py import build_py | 24 from distutils.command.build_py import build_py |
25 | 25 |
26 | 26 |
(...skipping 10 matching lines...) Expand all Loading... |
37 return '0x0%s' % ((maj * 100) + min) | 37 return '0x0%s' % ((maj * 100) + min) |
38 | 38 |
39 extensions = [Extension('_psutil_mswindows', | 39 extensions = [Extension('_psutil_mswindows', |
40 sources=['psutil/_psutil_mswindows.c', | 40 sources=['psutil/_psutil_mswindows.c', |
41 'psutil/_psutil_common.c', | 41 'psutil/_psutil_common.c', |
42 'psutil/arch/mswindows/process_info.c', | 42 'psutil/arch/mswindows/process_info.c', |
43 'psutil/arch/mswindows/process_handles.c', | 43 'psutil/arch/mswindows/process_handles.c', |
44 'psutil/arch/mswindows/security.c'], | 44 'psutil/arch/mswindows/security.c'], |
45 define_macros=[('_WIN32_WINNT', get_winver()), | 45 define_macros=[('_WIN32_WINNT', get_winver()), |
46 ('_AVAIL_WINVER_', get_winver())], | 46 ('_AVAIL_WINVER_', get_winver())], |
47 libraries=["psapi", "kernel32", "advapi32", "shell32
", | 47 libraries=["psapi", "kernel32", "advapi32", |
48 "netapi32"] | 48 "shell32", "netapi32", "iphlpapi"] |
49 )] | 49 )] |
50 # OS X | 50 # OS X |
51 elif sys.platform.lower().startswith("darwin"): | 51 elif sys.platform.lower().startswith("darwin"): |
52 extensions = [Extension('_psutil_osx', | 52 extensions = [Extension('_psutil_osx', |
53 sources = ['psutil/_psutil_osx.c', | 53 sources = ['psutil/_psutil_osx.c', |
54 'psutil/_psutil_common.c', | 54 'psutil/_psutil_common.c', |
55 'psutil/arch/osx/process_info.c'], | 55 'psutil/arch/osx/process_info.c'], |
56 extra_link_args=['-framework', 'CoreFoundation', '-f
ramework', 'IOKit'] | 56 extra_link_args=['-framework', 'CoreFoundation', |
| 57 '-framework', 'IOKit'] |
57 ), | 58 ), |
58 posix_extension] | 59 posix_extension] |
59 # FreeBSD | 60 # FreeBSD |
60 elif sys.platform.lower().startswith("freebsd"): | 61 elif sys.platform.lower().startswith("freebsd"): |
61 extensions = [Extension('_psutil_bsd', | 62 extensions = [Extension('_psutil_bsd', |
62 sources = ['psutil/_psutil_bsd.c', | 63 sources = ['psutil/_psutil_bsd.c', |
63 'psutil/_psutil_common.c', | 64 'psutil/_psutil_common.c', |
64 'psutil/arch/bsd/process_info.c'] | 65 'psutil/arch/bsd/process_info.c'], |
| 66 libraries=["devstat"], |
65 ), | 67 ), |
66 posix_extension] | 68 posix_extension] |
67 # Linux | 69 # Linux |
68 elif sys.platform.lower().startswith("linux"): | 70 elif sys.platform.lower().startswith("linux"): |
69 extensions = [Extension('_psutil_linux', | 71 extensions = [Extension('_psutil_linux', |
70 sources=['psutil/_psutil_linux.c'], | 72 sources=['psutil/_psutil_linux.c'], |
71 ), | 73 ), |
72 posix_extension] | 74 posix_extension] |
73 | 75 |
74 else: | 76 else: |
75 raise NotImplementedError('platform %s is not supported' % sys.platform) | 77 raise NotImplementedError('platform %s is not supported' % sys.platform) |
76 | 78 |
77 | 79 |
78 def main(): | 80 def main(): |
79 setup_args = dict( | 81 setup_args = dict( |
80 name='psutil', | 82 name='psutil', |
81 version=__ver__, | 83 version=__ver__, |
82 download_url="http://psutil.googlecode.com/files/psutil-%s.tar.gz" % __v
er__, | 84 download_url="http://psutil.googlecode.com/files/psutil-%s.tar.gz" % __v
er__, |
83 description='A process utilities module for Python', | 85 description='A process utilities module for Python', |
84 long_description="""\ | 86 long_description="""\ |
85 psutil is a module providing convenience functions for monitoring | 87 psutil is a module providing convenience functions for monitoring |
86 system and processes in a portable way by using Python.""", | 88 system and processes in a portable way by using Python.""", |
87 keywords=['ps', 'top', 'kill', 'free', 'lsof', 'netstat', 'nice', | 89 keywords=['ps', 'top', 'kill', 'free', 'lsof', 'netstat', 'nice', |
88 'tty', 'ionice', 'uptime', 'taskmgr', 'process', 'df', | 90 'tty', 'ionice', 'uptime', 'taskmgr', 'process', 'df', |
89 'monitoring'], | 91 'iotop', 'iostat', 'monitoring',], |
90 author='Giampaolo Rodola, Jay Loden', | 92 author='Giampaolo Rodola, Jay Loden', |
91 author_email='psutil@googlegroups.com', | 93 author_email='psutil@googlegroups.com', |
92 url='http://code.google.com/p/psutil/', | 94 url='http://code.google.com/p/psutil/', |
93 platforms='Platform Independent', | 95 platforms='Platform Independent', |
94 license='License :: OSI Approved :: BSD License', | 96 license='License :: OSI Approved :: BSD License', |
95 packages=['psutil'], | 97 packages=['psutil'], |
96 cmdclass={'build_py':build_py}, # Python 3.X | 98 cmdclass={'build_py':build_py}, # Python 3.X |
97 classifiers=[ | 99 classifiers=[ |
98 'Development Status :: 5 - Production/Stable', | 100 'Development Status :: 5 - Production/Stable', |
99 'Environment :: Console', | 101 'Environment :: Console', |
(...skipping 26 matching lines...) Expand all Loading... |
126 ) | 128 ) |
127 if extensions is not None: | 129 if extensions is not None: |
128 setup_args["ext_modules"] = extensions | 130 setup_args["ext_modules"] = extensions |
129 | 131 |
130 setup(**setup_args) | 132 setup(**setup_args) |
131 | 133 |
132 | 134 |
133 if __name__ == '__main__': | 135 if __name__ == '__main__': |
134 main() | 136 main() |
135 | 137 |
OLD | NEW |