-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
127 lines (112 loc) · 4.95 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env python
#
# $Id$
#
import sys
import os
import shutil
from distutils.core import setup, Extension
# Hack for Python 3 to tell distutils to run 2to3 against the files
# copied in the build directory before installing.
# Reference: http://osdir.com/ml/python.python-3000.cvs/2008-03/msg00127.html
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
if os.name == 'posix':
posix_extension = Extension('_psutil_posix',
sources = ['psutil/_psutil_posix.c'])
# Windows
if sys.platform.lower().startswith("win"):
def get_winver():
maj,min = sys.getwindowsversion()[0:2]
return '0x0%s' % ((maj * 100) + min)
extensions = [Extension('_psutil_mswindows',
sources=['psutil/_psutil_mswindows.c',
'psutil/_psutil_common.c',
'psutil/arch/mswindows/process_info.c',
'psutil/arch/mswindows/process_handles.c',
'psutil/arch/mswindows/security.c'],
define_macros=[('_WIN32_WINNT', get_winver()),
('_AVAIL_WINVER_', get_winver())],
libraries=["psapi", "kernel32", "advapi32", "shell32",
"netapi32"]
)]
# OS X
elif sys.platform.lower().startswith("darwin"):
extensions = [Extension('_psutil_osx',
sources = ['psutil/_psutil_osx.c',
'psutil/_psutil_common.c',
'psutil/arch/osx/process_info.c']
),
posix_extension]
# FreeBSD
elif sys.platform.lower().startswith("freebsd"):
extensions = [Extension('_psutil_bsd',
sources = ['psutil/_psutil_bsd.c',
'psutil/_psutil_common.c',
'psutil/arch/bsd/process_info.c']
),
posix_extension]
# Linux
elif sys.platform.lower().startswith("linux"):
extensions = [Extension('_psutil_linux',
sources=['psutil/_psutil_linux.c'],
libraries=[]
),
posix_extension]
else:
raise NotImplementedError('platform %s is not supported' % sys.platform)
def main():
setup_args = dict(
name='psutil',
version="0.2.1",
download_url="http://psutil.googlecode.com/files/psutil-0.2.0.tar.gz",
description='A process utilities module for Python',
long_description="""
psutil is a module providing convenience functions for managing processes in a
portable way by using Python.""",
keywords=['psutil', 'ps', 'top', 'process', 'utility', 'lsof', 'top',
'netstat', 'taskmgr'],
author='Giampaolo Rodola, Dave Daeschler, Jay Loden',
author_email='[email protected]',
url='http://code.google.com/p/psutil/',
platforms='Platform Independent',
license='License :: OSI Approved :: BSD License',
packages=['psutil'],
cmdclass={'build_py':build_py}, # Python 3.X
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows :: Windows NT/2000',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: BSD :: FreeBSD',
'Operating System :: OS Independent',
'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.4',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.0',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Topic :: System :: Monitoring',
'Topic :: System :: Networking',
'Topic :: System :: Benchmark',
'Topic :: System :: Systems Administration',
'Topic :: Utilities',
'Topic :: Software Development :: Libraries :: Python Modules',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
],
)
if extensions is not None:
setup_args["ext_modules"] = extensions
setup(**setup_args)
if __name__ == '__main__':
main()