Commit bffefc84 authored by Jondy Zhao's avatar Jondy Zhao

Patch psutil for cygwin

parent a53a068c
Metadata-Version: 1.1
Metadata-Version: 1.0
Name: psutil
Version: 0.6.1
Version: 0.6.01
Summary: A process and system utilities module for Python
Home-page: http://code.google.com/p/psutil/
Author: Giampaolo Rodola
Author-email: g.rodola <at> gmail <dot> com
License: License :: OSI Approved :: BSD License
Download-URL: http://psutil.googlecode.com/files/psutil-0.6.1.tar.gz
Download-URL: http://psutil.googlecode.com/files/psutil-0.6.01.tar.gz
Description: ===========
Quick links
===========
......
......@@ -4,6 +4,7 @@ INSTALL
LICENSE
MANIFEST.in
README
setup.cfg
setup.py
examples/disk_usage.py
examples/free.py
......@@ -37,6 +38,7 @@ psutil/_psutil_osx.h
psutil/_psutil_posix.c
psutil/_psutil_posix.h
psutil/error.py
psutil/tchar.h
psutil.egg-info/PKG-INFO
psutil.egg-info/SOURCES.txt
psutil.egg-info/dependency_links.txt
......
psutil
_psutil_linux
_psutil_posix
_psutil_mswindows
......@@ -14,7 +14,7 @@ Python.
from __future__ import division
__version__ = "0.6.1"
__version__ = "0.6.01"
version_info = tuple([int(num) for num in __version__.split('.')])
__all__ = [
......@@ -90,6 +90,15 @@ elif sys.platform.startswith("cygwin"):
NORMAL_PRIORITY_CLASS,
REALTIME_PRIORITY_CLASS)
elif sys.platform.startswith("cygwin"):
import psutil._psmswindows as _psplatform
from psutil._psmswindows import (ABOVE_NORMAL_PRIORITY_CLASS,
BELOW_NORMAL_PRIORITY_CLASS,
HIGH_PRIORITY_CLASS,
IDLE_PRIORITY_CLASS,
NORMAL_PRIORITY_CLASS,
REALTIME_PRIORITY_CLASS)
elif sys.platform.startswith("darwin"):
import psutil._psosx as _psplatform
......
......@@ -17,14 +17,22 @@
#include <time.h>
#include <lm.h>
#include <WinIoCtl.h>
#if defined(__CYGWIN__)
#include "tchar.h"
#else
#include <tchar.h>
#endif
#include <tlhelp32.h>
#include <winsock2.h>
#include <iphlpapi.h>
#include <wtsapi32.h>
// Link with Iphlpapi.lib
#if !defined(__CYGWIN__)
#pragma comment(lib, "IPHLPAPI.lib")
#endif
#include "_psutil_mswindows.h"
#include "_psutil_common.h"
......@@ -552,7 +560,11 @@ static PyObject*
get_process_exe(PyObject* self, PyObject* args) {
long pid;
HANDLE hProcess;
#if defined(_UNICODE)
wchar_t exe[MAX_PATH];
#else
char exe[MAX_PATH];
#endif
DWORD nSize = MAX_PATH;
if (! PyArg_ParseTuple(args, "l", &pid)) {
......@@ -1379,7 +1391,7 @@ static char *state_to_string(ULONG state)
}
/* mingw support */
#ifndef _IPRTRMIB_H
#if !defined(_IPRTRMIB_H) && !defined(__CYGWIN__)
typedef struct _MIB_TCP6ROW_OWNER_PID
{
UCHAR ucLocalAddr[16];
......@@ -1429,6 +1441,7 @@ typedef struct _MIB_UDPTABLE_OWNER_PID
#endif
/* end of mingw support */
#if ! defined(__CYGWIN__)
typedef struct _MIB_UDP6ROW_OWNER_PID {
UCHAR ucLocalAddr[16];
DWORD dwLocalScopeId;
......@@ -1441,7 +1454,7 @@ typedef struct _MIB_UDP6TABLE_OWNER_PID
DWORD dwNumEntries;
MIB_UDP6ROW_OWNER_PID table[ANY_SIZE];
} MIB_UDP6TABLE_OWNER_PID, *PMIB_UDP6TABLE_OWNER_PID;
#endif
#define ConnDecrefPyObjs() Py_DECREF(_AF_INET); \
Py_DECREF(_AF_INET6);\
......
......@@ -12,6 +12,8 @@
#include <windows.h>
#include <Python.h>
#include "security.h"
/*
* Convert a process handle to a process token handle.
*/
......
......@@ -11,10 +11,14 @@
#include <windows.h>
#if defined(__CYGWIN__)
#define PyErr_SetFromWindowsErr(n) \
PyErr_Format(PyExc_RuntimeError, "Windoows Error: %d\n", n)
#endif
BOOL SetPrivilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege);
int SetSeDebug();
int UnsetSeDebug();
int SetSeDebug(void);
int UnsetSeDebug(void);
HANDLE token_from_handle(HANDLE hProcess);
int HasSystemPrivilege(HANDLE hProcess);
This diff is collapsed.
......@@ -67,6 +67,31 @@ if sys.platform.startswith("win32"):
#extra_compile_args=["/Z7"],
#extra_link_args=["/DEBUG"]
)]
elif sys.platform.startswith("cygwin"):
def get_winver():
return '0x0503'
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()),
# ('_UNICODE', 1),
('USE_SYS_TYPES_FD_SET', 1),
('__USE_W32_SOCKETS', 1)],
libraries=["psapi", "kernel32", "advapi32",
"shell32", "netapi32", "iphlpapi",
"wtsapi32"],
#extra_compile_args=["/Z7"],
#extra_link_args=["/DEBUG"]
)]
# OS X
elif sys.platform.startswith("darwin"):
extensions = [Extension('_psutil_osx',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment