python-psutil: Update to 5.4.6 (#3930)

This commit is contained in:
Peter Budai
2018-06-11 08:52:08 +02:00
committed by Алексей
parent 48d000d3a5
commit 3af7694ec8
3 changed files with 34 additions and 70 deletions

View File

@@ -14,16 +14,16 @@ diff --git a/psutil/_common.py b/psutil/_common.py
index 1e48b63..38d46f8 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -39,7 +39,7 @@ else:
@@ -43,7 +43,7 @@ else:
__all__ = [
# OS constants
# constants
'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'OSX', 'POSIX', 'SUNOS',
- 'WINDOWS',
+ 'WINDOWS', 'MSYS',
'ENCODING', 'ENCODING_ERRS', 'AF_INET6',
# connection constants
'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED',
'CONN_FIN_WAIT1', 'CONN_FIN_WAIT2', 'CONN_LAST_ACK', 'CONN_LISTEN',
@@ -69,6 +69,7 @@ __all__ = [
@@ -74,6 +74,7 @@ __all__ = [
POSIX = os.name == "posix"
WINDOWS = os.name == "nt"
@@ -35,31 +35,29 @@ diff --git a/setup.py b/setup.py
index a61b5ed..18472db 100644
--- a/setup.py
+++ b/setup.py
@@ -34,6 +34,7 @@
@@ -37,6 +37,7 @@
from _common import POSIX # NOQA
from _common import SUNOS # NOQA
from _common import WINDOWS # NOQA
+from _common import MSYS # NOQA
from _common import AIX # NOQA
macros = []
@@ -86,7 +86,7 @@
macros.append(('PSUTIL_VERSION', int(VERSION.replace('.', ''))))
@@ -103,7 +104,7 @@
setattr(sys, stream_name, orig)
# Windows
-if WINDOWS:
+if WINDOWS or MSYS:
def get_winver():
maj, min = sys.getwindowsversion()[0:2]
return '0x0%s' % ((maj * 100) + min)
@@ -107,18 +107,22 @@
# see: https://github.com/giampaolo/psutil/issues/348
@@ -126,16 +127,20 @@
('PSAPI_VERSION', 1),
])
+
+ sources=[
+ sources= 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',
@@ -68,12 +66,11 @@ index a61b5ed..18472db 100644
+
+ if not MSYS:
+ sources.append('psutil/arch/windows/inet_ntop.c')
+
ext = Extension(
'psutil._psutil_windows',
- sources=[
- sources=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',

View File

@@ -28,27 +28,21 @@ index ebc4368..98c01df 100644
#include <iphlpapi.h>
#include <wtsapi32.h>
#include <Winsvc.h>
@@ -33,14 +37,14 @@
@@ -34,8 +38,13 @@
#include "arch/windows/security.h"
#include "arch/windows/process_info.h"
#include "arch/windows/process_handles.h"
+#ifndef __MINGW32__
#include "arch/windows/ntextapi.h"
#include "arch/windows/inet_ntop.h"
-#include "arch/windows/services.h"
-
-#ifdef __MINGW32__
-#include "arch/windows/glpi.h"
+#else
+#include <winternl.h>
+#include <ws2tcpip.h>
#endif
-
+#include "arch/windows/services.h"
+#endif
#include "arch/windows/services.h"
/*
* ============================================================================
@@ -85,54 +89,8 @@ typedef struct _DISK_PERFORMANCE_WIN_2008 {
@@ -87,54 +96,8 @@
WCHAR StorageManagerName[8];
} DISK_PERFORMANCE_WIN_2008;
@@ -104,7 +98,7 @@ index ebc4368..98c01df 100644
typedef struct _MIB_UDP6ROW_OWNER_PID {
UCHAR ucLocalAddr[16];
DWORD dwLocalScopeId;
@@ -145,6 +103,7 @@ typedef struct _MIB_UDP6TABLE_OWNER_PID {
@@ -147,6 +110,7 @@
MIB_UDP6ROW_OWNER_PID table[ANY_SIZE];
} MIB_UDP6TABLE_OWNER_PID, *PMIB_UDP6TABLE_OWNER_PID;
#endif
@@ -112,7 +106,7 @@ index ebc4368..98c01df 100644
typedef struct _PROCESSOR_POWER_INFORMATION {
ULONG Number;
@@ -159,7 +159,7 @@
@@ -161,7 +125,7 @@
PIP_ADAPTER_ADDRESSES
psutil_get_nic_addresses() {
// allocate a 15 KB buffer to start with
@@ -121,31 +115,11 @@ index ebc4368..98c01df 100644
DWORD dwRetVal = 0;
ULONG attempts = 0;
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
diff --git a/psutil/arch/windows/glpi.h b/psutil/arch/windows/glpi.h
index 6f98483..f51080b 100644
--- a/psutil/arch/windows/glpi.h
+++ b/psutil/arch/windows/glpi.h
@@ -1,5 +1,5 @@
-// mingw headers are missing this
-
+#if !defined(__GLPI_H__) && !defined(USING_MSYS)
+#define __GLPI_H__
typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
RelationProcessorCore,
RelationNumaNode,
@@ -38,4 +38,5 @@ typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
WINBASEAPI WINBOOL WINAPI
GetLogicalProcessorInformation(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,
- PDWORD ReturnedLength);
\ No newline at end of file
+ PDWORD ReturnedLength);
+#endif // __GLPI_H__
diff --git a/psutil/arch/windows/ntextapi.h b/psutil/arch/windows/ntextapi.h
index 74adce2..df1f436 100644
--- a/psutil/arch/windows/ntextapi.h
+++ b/psutil/arch/windows/ntextapi.h
@@ -120,7 +120,7 @@ typedef enum _KTHREAD_STATE {
@@ -120,7 +120,7 @@
MaximumThreadState
} KTHREAD_STATE, *PKTHREAD_STATE;
@@ -154,21 +128,15 @@ index 74adce2..df1f436 100644
typedef enum _KWAIT_REASON {
Executive = 0,
FreePage = 1,
@@ -162,12 +162,11 @@ typedef enum _KWAIT_REASON {
MaximumWaitReason = 37
} KWAIT_REASON, *PKWAIT_REASON;
@@ -170,6 +170,7 @@
-
typedef struct _CLIENT_ID {
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID, *PCLIENT_ID;
-
#define CLIENT_ID CLIENT_ID2
#define PCLIENT_ID PCLIENT_ID2
+#endif
typedef struct _SYSTEM_THREAD_INFORMATION {
typedef struct _SYSTEM_THREAD_INFORMATION2 {
LARGE_INTEGER KernelTime;
@@ -286,7 +285,7 @@ typedef NTSTATUS (NTAPI *_NtSetInformationProcess)(
@@ -290,7 +291,7 @@
DWORD ProcessInformationLength
);
@@ -177,11 +145,10 @@ index 74adce2..df1f436 100644
typedef enum _PROCESSINFOCLASS2 {
_ProcessBasicInformation,
ProcessQuotaLimits,
@@ -334,5 +333,13 @@ typedef enum _PROCESSINFOCLASS2 {
#define ProcessDebugPort _ProcessDebugPort
@@ -342,4 +343,12 @@
#define ProcessImageFileName _ProcessImageFileName
#define ProcessBreakOnTermination _ProcessBreakOnTermination
+
+#else
+// values from https://msdn.microsoft.com/en-us/library/windows/desktop/ms684280(v=vs.85).aspx
+#define ProcessBasicInformation 0
@@ -189,7 +156,7 @@ index 74adce2..df1f436 100644
+#define ProcessDebugPort 7
+#define ProcessImageFileName 27
+#endif
+
#endif // __NTEXTAPI_H__
diff --git a/psutil/arch/windows/process_handles.h b/psutil/arch/windows/process_handles.h
index ea5fbdb..583e3ff 100644

View File

@@ -5,7 +5,7 @@ _realname=${_pyname}
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}"
"${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=5.2.2
pkgver=5.4.6
pkgrel=1
pkgdesc="A cross-platform process and system utilities module for Python (mingw-w64)"
arch=('any')
@@ -19,9 +19,9 @@ options=('staticlibs' 'strip' '!debug')
source=(${_realname}-${pkgver}.tar.gz::"${url}/${_realname}/archive/release-${pkgver}.tar.gz"
'0001-MSYS-Allow-detecting-when-running-on-MSYS.patch'
'0002-msys-fixes-for-msys2.patch')
sha256sums=('ed4711cc736330c6093fdfe775c5b6d5a4111a427562349d92ee51588dd06e2c'
'1b0d3105dca0c9137ff8097a2e4c5c3612cd20bcf263d4a46065515f28285fb3'
'309af06b394831183dd117ad87bfe536edf379ade3b1d5b34f8f930f71d9d967')
sha256sums=('1fbe56d7937410837ff4f8a250a9d80fcb652982982a0a2a999f906bcea4bafc'
'8087aefe39b9037a7bd8dec2c51007da6b8aa92f8e9b45c221df0dbe8454ca5c'
'fd5c0547eac613e63aca1a1aba160f955971620c116332edac4cfc5be62acddb')
prepare() {
cd "${srcdir}"/${_realname}-release-${pkgver}