OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # | |
3 # $Id: setup.py 1142 2011-10-05 18:45:49Z g.rodola $ | |
4 # | |
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 | |
7 # found in the LICENSE file. | |
8 | |
9 import sys | |
10 import os | |
11 try: | |
12 from setuptools import setup, Extension | |
13 except ImportError: | |
14 from distutils.core import setup, Extension | |
15 | |
16 __ver__ = "0.3.1" | |
17 | |
18 # Hack for Python 3 to tell distutils to run 2to3 against the files | |
19 # copied in the build directory before installing. | |
20 # Reference: http://docs.python.org/dev/howto/pyporting.html#during-installation | |
21 try: | |
22 from distutils.command.build_py import build_py_2to3 as build_py | |
23 except ImportError: | |
24 from distutils.command.build_py import build_py | |
25 | |
26 | |
27 if os.name == 'posix': | |
28 posix_extension = Extension('_psutil_posix', | |
29 sources = ['psutil/_psutil_posix.c']) | |
30 | |
31 | |
32 # Windows | |
33 if sys.platform.lower().startswith("win"): | |
34 | |
35 def get_winver(): | |
36 maj,min = sys.getwindowsversion()[0:2] | |
37 return '0x0%s' % ((maj * 100) + min) | |
38 | |
39 extensions = [Extension('_psutil_mswindows', | |
40 sources=['psutil/_psutil_mswindows.c', | |
41 'psutil/_psutil_common.c', | |
42 'psutil/arch/mswindows/process_info.c', | |
43 'psutil/arch/mswindows/process_handles.c', | |
44 'psutil/arch/mswindows/security.c'], | |
45 define_macros=[('_WIN32_WINNT', get_winver()), | |
46 ('_AVAIL_WINVER_', get_winver())], | |
47 libraries=["psapi", "kernel32", "advapi32", "shell32
", | |
48 "netapi32"] | |
49 )] | |
50 # OS X | |
51 elif sys.platform.lower().startswith("darwin"): | |
52 extensions = [Extension('_psutil_osx', | |
53 sources = ['psutil/_psutil_osx.c', | |
54 'psutil/_psutil_common.c', | |
55 'psutil/arch/osx/process_info.c'], | |
56 extra_link_args=['-framework', 'CoreFoundation', '-f
ramework', 'IOKit'] | |
57 ), | |
58 posix_extension] | |
59 # FreeBSD | |
60 elif sys.platform.lower().startswith("freebsd"): | |
61 extensions = [Extension('_psutil_bsd', | |
62 sources = ['psutil/_psutil_bsd.c', | |
63 'psutil/_psutil_common.c', | |
64 'psutil/arch/bsd/process_info.c'] | |
65 ), | |
66 posix_extension] | |
67 # Linux | |
68 elif sys.platform.lower().startswith("linux"): | |
69 extensions = [Extension('_psutil_linux', | |
70 sources=['psutil/_psutil_linux.c'], | |
71 ), | |
72 posix_extension] | |
73 | |
74 else: | |
75 raise NotImplementedError('platform %s is not supported' % sys.platform) | |
76 | |
77 | |
78 def main(): | |
79 setup_args = dict( | |
80 name='psutil', | |
81 version=__ver__, | |
82 download_url="http://psutil.googlecode.com/files/psutil-%s.tar.gz" % __v
er__, | |
83 description='A process utilities module for Python', | |
84 long_description="""\ | |
85 psutil is a module providing convenience functions for monitoring | |
86 system and processes in a portable way by using Python.""", | |
87 keywords=['ps', 'top', 'kill', 'free', 'lsof', 'netstat', 'nice', | |
88 'tty', 'ionice', 'uptime', 'taskmgr', 'process', 'df', | |
89 'monitoring'], | |
90 author='Giampaolo Rodola, Jay Loden', | |
91 author_email='psutil@googlegroups.com', | |
92 url='http://code.google.com/p/psutil/', | |
93 platforms='Platform Independent', | |
94 license='License :: OSI Approved :: BSD License', | |
95 packages=['psutil'], | |
96 cmdclass={'build_py':build_py}, # Python 3.X | |
97 classifiers=[ | |
98 'Development Status :: 5 - Production/Stable', | |
99 'Environment :: Console', | |
100 'Operating System :: MacOS :: MacOS X', | |
101 'Operating System :: Microsoft :: Windows :: Windows NT/2000', | |
102 'Operating System :: POSIX :: Linux', | |
103 'Operating System :: POSIX :: BSD :: FreeBSD', | |
104 'Operating System :: OS Independent', | |
105 'Programming Language :: C', | |
106 'Programming Language :: Python', | |
107 'Programming Language :: Python :: 2', | |
108 'Programming Language :: Python :: 2.4', | |
109 'Programming Language :: Python :: 2.5', | |
110 'Programming Language :: Python :: 2.6', | |
111 'Programming Language :: Python :: 2.7', | |
112 'Programming Language :: Python :: 3', | |
113 'Programming Language :: Python :: 3.0', | |
114 'Programming Language :: Python :: 3.1', | |
115 'Programming Language :: Python :: 3.2', | |
116 'Topic :: System :: Monitoring', | |
117 'Topic :: System :: Networking', | |
118 'Topic :: System :: Benchmark', | |
119 'Topic :: System :: Systems Administration', | |
120 'Topic :: Utilities', | |
121 'Topic :: Software Development :: Libraries :: Python Modules', | |
122 'Intended Audience :: Developers', | |
123 'Intended Audience :: System Administrators', | |
124 'License :: OSI Approved :: MIT License', | |
125 ], | |
126 ) | |
127 if extensions is not None: | |
128 setup_args["ext_modules"] = extensions | |
129 | |
130 setup(**setup_args) | |
131 | |
132 | |
133 if __name__ == '__main__': | |
134 main() | |
135 | |
OLD | NEW |