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