Bug 1196253 - update in-tree psutil to 3.1.1. r=gps

This commit is contained in:
Joel Maher
2015-08-20 08:03:31 -04:00
parent e27f1455ab
commit 6fabf5a7a3
73 changed files with 6544 additions and 3863 deletions

View File

@@ -22,8 +22,7 @@ HERE = os.path.abspath(os.path.dirname(__file__))
def get_version():
INIT = os.path.join(HERE, 'psutil/__init__.py')
f = open(INIT, 'r')
try:
with open(INIT, 'r') as f:
for line in f:
if line.startswith('__version__'):
ret = eval(line.strip().split(' = ')[1])
@@ -33,24 +32,28 @@ def get_version():
return ret
else:
raise ValueError("couldn't find version string")
finally:
f.close()
def get_description():
README = os.path.join(HERE, 'README.rst')
f = open(README, 'r')
try:
with open(README, 'r') as f:
return f.read()
finally:
f.close()
VERSION = get_version()
VERSION_MACRO = ('PSUTIL_VERSION', int(VERSION.replace('.', '')))
# POSIX
if os.name == 'posix':
libraries = []
if sys.platform.startswith("sunos"):
libraries.append('socket')
posix_extension = Extension(
'_psutil_posix',
'psutil._psutil_posix',
sources=['psutil/_psutil_posix.c'],
libraries=libraries,
)
# Windows
if sys.platform.startswith("win32"):
@@ -60,25 +63,28 @@ if sys.platform.startswith("win32"):
return '0x0%s' % ((maj * 100) + min)
extensions = [Extension(
'_psutil_windows',
'psutil._psutil_windows',
sources=[
'psutil/_psutil_windows.c',
'psutil/_psutil_common.c',
'psutil/arch/windows/process_info.c',
'psutil/arch/windows/process_handles.c',
'psutil/arch/windows/security.c',
'psutil/arch/windows/inet_ntop.c',
],
define_macros=[
VERSION_MACRO,
# be nice to mingw, see:
# http://www.mingw.org/wiki/Use_more_recent_defined_functions
('_WIN32_WINNT', get_winver()),
('_AVAIL_WINVER_', get_winver()),
('_CRT_SECURE_NO_WARNINGS', None),
# see: https://github.com/giampaolo/psutil/issues/348
('PSAPI_VERSION', 1),
],
libraries=[
"psapi", "kernel32", "advapi32", "shell32", "netapi32", "iphlpapi",
"wtsapi32",
"wtsapi32", "ws2_32",
],
# extra_compile_args=["/Z7"],
# extra_link_args=["/DEBUG"]
@@ -86,12 +92,13 @@ if sys.platform.startswith("win32"):
# OS X
elif sys.platform.startswith("darwin"):
extensions = [Extension(
'_psutil_osx',
'psutil._psutil_osx',
sources=[
'psutil/_psutil_osx.c',
'psutil/_psutil_common.c',
'psutil/arch/osx/process_info.c'
],
define_macros=[VERSION_MACRO],
extra_link_args=[
'-framework', 'CoreFoundation', '-framework', 'IOKit'
],
@@ -101,28 +108,31 @@ elif sys.platform.startswith("darwin"):
# FreeBSD
elif sys.platform.startswith("freebsd"):
extensions = [Extension(
'_psutil_bsd',
'psutil._psutil_bsd',
sources=[
'psutil/_psutil_bsd.c',
'psutil/_psutil_common.c',
'psutil/arch/bsd/process_info.c'
],
define_macros=[VERSION_MACRO],
libraries=["devstat"]),
posix_extension,
]
# Linux
elif sys.platform.startswith("linux"):
extensions = [Extension(
'_psutil_linux',
sources=['psutil/_psutil_linux.c']),
'psutil._psutil_linux',
sources=['psutil/_psutil_linux.c'],
define_macros=[VERSION_MACRO]),
posix_extension,
]
# Solaris
elif sys.platform.lower().startswith('sunos'):
extensions = [Extension(
'_psutil_sunos',
'psutil._psutil_sunos',
sources=['psutil/_psutil_sunos.c'],
libraries=['kstat', 'nsl'],),
define_macros=[VERSION_MACRO],
libraries=['kstat', 'nsl', 'socket']),
posix_extension,
]
else:
@@ -132,14 +142,14 @@ else:
def main():
setup_args = dict(
name='psutil',
version=get_version(),
version=VERSION,
description=__doc__.replace('\n', '').strip(),
long_description=get_description(),
keywords=[
'ps', 'top', 'kill', 'free', 'lsof', 'netstat', 'nice',
'tty', 'ionice', 'uptime', 'taskmgr', 'process', 'df',
'iotop', 'iostat', 'ifconfig', 'taskset', 'who', 'pidof',
'pmap', 'smem', 'monitoring', 'ulimit', 'prlimit',
'ps', 'top', 'kill', 'free', 'lsof', 'netstat', 'nice', 'tty',
'ionice', 'uptime', 'taskmgr', 'process', 'df', 'iotop', 'iostat',
'ifconfig', 'taskset', 'who', 'pidof', 'pmap', 'smem', 'pstree',
'monitoring', 'ulimit', 'prlimit',
],
author='Giampaolo Rodola',
author_email='g.rodola <at> gmail <dot> com',
@@ -166,8 +176,6 @@ def main():
'Operating System :: POSIX',
'Programming Language :: C',
'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',