summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-01-01 23:18:59 -0800
committerGitHub <noreply@github.com>2020-01-01 23:18:59 -0800
commit9e04312d615413c78a7c87d70e9de125429c9d33 (patch)
treeffd1d0ed95dfe6009ee625c8cde629c5ed9b7a9e
parent0cbab098df8f8d6e242917d44c2231e0a35c8c11 (diff)
downloadpsutil-9e04312d615413c78a7c87d70e9de125429c9d33.tar.gz
Drop windows XP support (#1652)
minimum supported now is Windows Vista
-rw-r--r--HISTORY.rst2
-rw-r--r--docs/index.rst4
-rw-r--r--psutil/__init__.py2
-rw-r--r--psutil/_pslinux.py3
-rw-r--r--psutil/_psutil_windows.c79
-rw-r--r--psutil/_pswindows.py26
-rw-r--r--psutil/arch/windows/global.c2
-rwxr-xr-xscripts/internal/winmake.py1
8 files changed, 11 insertions, 108 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 16d18c08..f367db3e 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -9,6 +9,8 @@ XXXX-XX-XX
- 1648_: [Linux] sensors_temperatures() looks into an additional /sys/device/
directory for additional data. (patch by Javad Karabi)
+- 1652_: [Windows] dropped Windows XP support. Minumum supported client now is
+ Windows Vista.
**Bug fixes**
diff --git a/docs/index.rst b/docs/index.rst
index 5ed3bb7c..a7d86dd4 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -2607,9 +2607,9 @@ Supported platforms
These are the platforms I develop and test on:
-* Linux Ubuntu 16.04
+* Linux Ubuntu 18.04
+* Windows 10 (support back to Windows Vista)
* MacOS 10.11 El Captain
-* Windows 10
* Solaris 10
* FreeBSD 11
* OpenBSD 6.4
diff --git a/psutil/__init__.py b/psutil/__init__.py
index b267239e..3eaa88ce 100644
--- a/psutil/__init__.py
+++ b/psutil/__init__.py
@@ -222,7 +222,7 @@ __all__ = [
__all__.extend(_psplatform.__extra__all__)
__author__ = "Giampaolo Rodola'"
-__version__ = "5.6.7"
+__version__ = "5.6.8"
version_info = tuple([int(num) for num in __version__.split('.')])
_timer = getattr(time, 'monotonic', time.time)
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index e95581cc..694e307b 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1206,7 +1206,8 @@ def sensors_temperatures():
# https://github.com/giampaolo/psutil/issues/971
# https://github.com/nicolargo/glances/issues/1060
basenames.extend(glob.glob('/sys/class/hwmon/hwmon*/device/temp*_*'))
- basenames.extend(glob.glob('/sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_*'))
+ basenames.extend(glob.glob(
+ '/sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_*'))
basenames = sorted(set([x.split('_')[0] for x in basenames]))
for base in basenames:
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 660e08af..b572f0e1 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -26,9 +26,7 @@
#include <tlhelp32.h>
#include <wtsapi32.h> // users()
#include <PowrProf.h> // cpu_freq()
-#if (_WIN32_WINNT >= 0x0600) // Windows >= Vista
#include <ws2tcpip.h> // net_io_counters()
-#endif
// Link with Iphlpapi.lib
#pragma comment(lib, "IPHLPAPI.lib")
@@ -625,9 +623,7 @@ psutil_proc_exe(PyObject *self, PyObject *args) {
long pid;
HANDLE hProcess;
wchar_t exe[MAX_PATH];
-#if (_WIN32_WINNT >= 0x0600) // >= Vista
unsigned int size = sizeof(exe);
-#endif
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
@@ -639,24 +635,12 @@ psutil_proc_exe(PyObject *self, PyObject *args) {
// QueryFullProcessImageNameW is better than GetProcessImageFileNameW
// (avoid using QueryDosDevice on the returned path), see:
// https://github.com/giampaolo/psutil/issues/1394
-#if (_WIN32_WINNT >= 0x0600) // Windows >= Vista
memset(exe, 0, MAX_PATH);
if (QueryFullProcessImageNameW(hProcess, 0, exe, &size) == 0) {
PyErr_SetFromOSErrnoWithSyscall("QueryFullProcessImageNameW");
CloseHandle(hProcess);
return NULL;
}
-#else // Windows XP
- if (GetProcessImageFileNameW(hProcess, exe, MAX_PATH) == 0) {
- // see: https://github.com/giampaolo/psutil/issues/1394
- if (GetLastError() == 0)
- PyErr_SetFromWindowsErr(ERROR_ACCESS_DENIED);
- else
- PyErr_SetFromOSErrnoWithSyscall("GetProcessImageFileNameW");
- CloseHandle(hProcess);
- return NULL;
- }
-#endif
CloseHandle(hProcess);
return PyUnicode_FromWideChar(exe, wcslen(exe));
}
@@ -709,12 +693,7 @@ static PyObject *
psutil_proc_memory_info(PyObject *self, PyObject *args) {
HANDLE hProcess;
DWORD pid;
-#if (_WIN32_WINNT >= 0x0501) // Windows XP with SP2
PROCESS_MEMORY_COUNTERS_EX cnt;
-#else
- PROCESS_MEMORY_COUNTERS cnt;
-#endif
- SIZE_T private = 0;
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
@@ -729,11 +708,6 @@ psutil_proc_memory_info(PyObject *self, PyObject *args) {
CloseHandle(hProcess);
return NULL;
}
-
-#if (_WIN32_WINNT >= 0x0501) // Windows XP with SP2
- private = cnt.PrivateUsage;
-#endif
-
CloseHandle(hProcess);
// PROCESS_MEMORY_COUNTERS values are defined as SIZE_T which on 64bits
@@ -752,7 +726,7 @@ psutil_proc_memory_info(PyObject *self, PyObject *args) {
(unsigned long long)cnt.QuotaNonPagedPoolUsage,
(unsigned long long)cnt.PagefileUsage,
(unsigned long long)cnt.PeakPagefileUsage,
- (unsigned long long)private);
+ (unsigned long long)cnt.PrivateUsage);
#else
return Py_BuildValue(
"(kIIIIIIIII)",
@@ -765,7 +739,7 @@ psutil_proc_memory_info(PyObject *self, PyObject *args) {
(unsigned int)cnt.QuotaNonPagedPoolUsage,
(unsigned int)cnt.PagefileUsage,
(unsigned int)cnt.PeakPagefileUsage,
- (unsigned int)private);
+ (unsigned int)cnt.PrivateUsage);
#endif
}
@@ -1412,7 +1386,6 @@ psutil_proc_priority_set(PyObject *self, PyObject *args) {
}
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista
/*
* Get process IO priority as a Python integer.
*/
@@ -1475,7 +1448,6 @@ psutil_proc_io_priority_set(PyObject *self, PyObject *args) {
return psutil_SetFromNTStatusErr(status, "NtSetInformationProcess");
Py_RETURN_NONE;
}
-#endif
/*
@@ -1645,13 +1617,7 @@ return_:
static PyObject *
psutil_net_io_counters(PyObject *self, PyObject *args) {
DWORD dwRetVal = 0;
-
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista and above
MIB_IF_ROW2 *pIfRow = NULL;
-#else // Windows XP
- MIB_IFROW *pIfRow = NULL;
-#endif
-
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL;
PyObject *py_retdict = PyDict_New();
@@ -1669,33 +1635,21 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
py_nic_name = NULL;
py_nic_info = NULL;
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista and above
pIfRow = (MIB_IF_ROW2 *) malloc(sizeof(MIB_IF_ROW2));
-#else // Windows XP
- pIfRow = (MIB_IFROW *) malloc(sizeof(MIB_IFROW));
-#endif
-
if (pIfRow == NULL) {
PyErr_NoMemory();
goto error;
}
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista and above
SecureZeroMemory((PVOID)pIfRow, sizeof(MIB_IF_ROW2));
pIfRow->InterfaceIndex = pCurrAddresses->IfIndex;
dwRetVal = GetIfEntry2(pIfRow);
-#else // Windows XP
- pIfRow->dwIndex = pCurrAddresses->IfIndex;
- dwRetVal = GetIfEntry(pIfRow);
-#endif
-
if (dwRetVal != NO_ERROR) {
PyErr_SetString(PyExc_RuntimeError,
"GetIfEntry() or GetIfEntry2() syscalls failed.");
goto error;
}
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista and above
py_nic_info = Py_BuildValue("(KKKKKKKK)",
pIfRow->OutOctets,
pIfRow->InOctets,
@@ -1705,18 +1659,6 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
pIfRow->OutErrors,
pIfRow->InDiscards,
pIfRow->OutDiscards);
-#else // Windows XP
- py_nic_info = Py_BuildValue("(kkkkkkkk)",
- pIfRow->dwOutOctets,
- pIfRow->dwInOctets,
- (pIfRow->dwOutUcastPkts + pIfRow->dwOutNUcastPkts),
- (pIfRow->dwInUcastPkts + pIfRow->dwInNUcastPkts),
- pIfRow->dwInErrors,
- pIfRow->dwOutErrors,
- pIfRow->dwInDiscards,
- pIfRow->dwOutDiscards);
-#endif
-
if (!py_nic_info)
goto error;
@@ -2224,7 +2166,6 @@ psutil_proc_info(PyObject *self, PyObject *args) {
double user_time;
double kernel_time;
long long create_time;
- SIZE_T mem_private;
PyObject *py_retlist;
if (! PyArg_ParseTuple(args, "l", &pid))
@@ -2252,12 +2193,6 @@ psutil_proc_info(PyObject *self, PyObject *args) {
create_time /= 10000000;
}
-#if (_WIN32_WINNT >= 0x0501) // Windows XP with SP2
- mem_private = process->PrivatePageCount;
-#else
- mem_private = 0;
-#endif
-
py_retlist = Py_BuildValue(
#if defined(_WIN64)
"kkdddiKKKKKK" "kKKKKKKKKK",
@@ -2287,7 +2222,7 @@ psutil_proc_info(PyObject *self, PyObject *args) {
process->QuotaNonPagedPoolUsage, // non paged pool
process->PagefileUsage, // pagefile
process->PeakPagefileUsage, // peak pagefile
- mem_private // private
+ process->PrivatePageCount // private
);
free(buffer);
@@ -2461,11 +2396,9 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
char buff_macaddr[1024];
char buff_netmask[1024];
DWORD dwRetVal = 0;
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista and above
ULONG converted_netmask;
UINT netmask_bits;
struct in_addr in_netmask;
-#endif
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL;
PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL;
@@ -2548,7 +2481,6 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
sizeof(buff_addr));
if (!intRet)
goto error;
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista and above
netmask_bits = pUnicast->OnLinkPrefixLength;
dwRetVal = ConvertLengthToIpv4Mask(netmask_bits, &converted_netmask);
if (dwRetVal == NO_ERROR) {
@@ -2559,7 +2491,6 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
if (!netmaskIntRet)
goto error;
}
-#endif
}
else if (family == AF_INET6) {
struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)
@@ -2987,12 +2918,10 @@ PsutilMethods[] = {
"Return process priority."},
{"proc_priority_set", psutil_proc_priority_set, METH_VARARGS,
"Set process priority."},
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista
{"proc_io_priority_get", psutil_proc_io_priority_get, METH_VARARGS,
"Return process IO priority."},
{"proc_io_priority_set", psutil_proc_io_priority_set, METH_VARARGS,
"Set process IO priority."},
-#endif
{"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS,
"Return process CPU affinity as a bitmask."},
{"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS,
@@ -3049,13 +2978,11 @@ PsutilMethods[] = {
"Return NICs stats."},
{"cpu_freq", psutil_cpu_freq, METH_VARARGS,
"Return CPU frequency."},
-#if (_WIN32_WINNT >= 0x0600) // Windows Vista
{"init_loadavg_counter", (PyCFunction)psutil_init_loadavg_counter,
METH_VARARGS,
"Initializes the emulated load average calculator."},
{"getloadavg", (PyCFunction)psutil_get_loadavg, METH_VARARGS,
"Returns the emulated POSIX-like load average."},
-#endif
{"sensors_battery", psutil_sensors_battery, METH_VARARGS,
"Return battery metrics usage."},
{"getpagesize", psutil_getpagesize, METH_VARARGS,
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py
index 636b0af9..70485790 100644
--- a/psutil/_pswindows.py
+++ b/psutil/_pswindows.py
@@ -168,20 +168,6 @@ WIN_7 = (6, 1)
WIN_SERVER_2008 = (6, 0)
WIN_VISTA = (6, 0)
WIN_SERVER_2003 = (5, 2)
-WIN_XP = (5, 1)
-
-
-@lru_cache()
-def get_winver():
- """Usage:
- >>> if get_winver() <= WIN_VISTA:
- ... ...
- """
- wv = sys.getwindowsversion()
- return (wv.major, wv.minor)
-
-
-IS_WIN_XP = get_winver() < WIN_VISTA
# =====================================================================
@@ -785,17 +771,7 @@ class Process(object):
@wrap_exceptions
def exe(self):
- # Dual implementation, see:
- # https://github.com/giampaolo/psutil/pull/1413
- if not IS_WIN_XP:
- exe = cext.proc_exe(self.pid)
- else:
- if self.pid in (0, 4):
- # https://github.com/giampaolo/psutil/issues/414
- # https://github.com/giampaolo/psutil/issues/528
- raise AccessDenied(self.pid, self._name)
- exe = cext.proc_exe(self.pid)
- exe = convert_dos_path(exe)
+ exe = cext.proc_exe(self.pid)
return py2_strencode(exe)
@wrap_exceptions
diff --git a/psutil/arch/windows/global.c b/psutil/arch/windows/global.c
index 4d8526e3..a09bb337 100644
--- a/psutil/arch/windows/global.c
+++ b/psutil/arch/windows/global.c
@@ -123,13 +123,11 @@ psutil_loadlibs() {
if (! psutil_rtlIpv4AddressToStringA)
return 1;
- // minimum requirement: Win XP SP3
psutil_GetExtendedTcpTable = psutil_GetProcAddressFromLib(
"iphlpapi.dll", "GetExtendedTcpTable");
if (! psutil_GetExtendedTcpTable)
return 1;
- // minimum requirement: Win XP SP3
psutil_GetExtendedUdpTable = psutil_GetProcAddressFromLib(
"iphlpapi.dll", "GetExtendedUdpTable");
if (! psutil_GetExtendedUdpTable)
diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py
index c471ad0b..ce6b5a83 100755
--- a/scripts/internal/winmake.py
+++ b/scripts/internal/winmake.py
@@ -319,7 +319,6 @@ def install_pip():
@cmd
def install():
"""Install in develop / edit mode"""
- install_git_hooks()
build()
sh("%s setup.py develop" % PYTHON)