From 0f996734bdbd413f7dd8ce88d0c12227045609d1 Mon Sep 17 00:00:00 2001 From: Matthieu Darbois Date: Fri, 15 Apr 2022 14:08:58 +0200 Subject: [PATCH] Drop Python 2.6 support (#2039) Signed-off-by: mayeut --- Makefile | 2 +- README.rst | 2 +- docs/index.rst | 4 ++-- make.bat | 2 +- psutil/_common.py | 5 +---- psutil/tests/test_process.py | 2 +- psutil/tests/test_windows.py | 2 -- scripts/internal/print_announce.py | 2 +- setup.py | 3 +-- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index a0a70739b..7e998042a 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ DEPS = \ PY2_DEPS = \ futures \ ipaddress \ - mock==1.0.1 \ + mock \ unittest2 DEPS += `$(PYTHON) -c \ "import sys; print('$(PY2_DEPS)' if sys.version_info[0] == 2 else '')"` diff --git a/README.rst b/README.rst index a1d737a7a..0e0a29afd 100644 --- a/README.rst +++ b/README.rst @@ -94,7 +94,7 @@ psutil currently supports the following platforms: - **Sun Solaris** - **AIX** -Supported Python versions are **2.6**, **2.7**, **3.4+** and +Supported Python versions are **2.7**, **3.4+** and `PyPy `__. Funding diff --git a/docs/index.rst b/docs/index.rst index 82872a2b5..7cf673ef4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -38,7 +38,7 @@ psutil currently supports the following platforms: - **Sun Solaris** - **AIX** -Supported Python versions are **2.6**, **2.7** and **3.4+**. +Supported Python versions are **2.7** and **3.4+**. `PyPy `__ is also known to work. The psutil documentation you're reading is distributed as a single HTML page. @@ -2609,7 +2609,7 @@ Platforms support history * psutil 0.1.1 (2009-03): **FreeBSD** * psutil 0.1.0 (2009-01): **Linux, Windows, macOS** -Supported Python versions are 2.6, 2.7, 3.4+ and PyPy3. +Supported Python versions are 2.7, 3.4+ and PyPy3. Timeline ======== diff --git a/make.bat b/make.bat index e292bb16b..b424ed203 100644 --- a/make.bat +++ b/make.bat @@ -7,7 +7,7 @@ rem psutil ("make.bat build", "make.bat install") and running tests rem ("make.bat test"). rem rem This script is modeled after my Windows installation which uses: -rem - Visual studio 2008 for Python 2.6, 2.7 +rem - Visual studio 2008 for Python 2.7 rem - Visual studio 2010 for Python 3.4+ rem ...therefore it might not work on your Windows installation. rem diff --git a/psutil/_common.py b/psutil/_common.py index ef3e8664b..9937eb832 100644 --- a/psutil/_common.py +++ b/psutil/_common.py @@ -281,10 +281,7 @@ class Error(Exception): __module__ = 'psutil' def _infodict(self, attrs): - try: - info = collections.OrderedDict() - except AttributeError: # pragma: no cover - info = {} # Python 2.6 + info = collections.OrderedDict() for name in attrs: value = getattr(self, name, None) if value: diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index 181097e3b..ef96e7971 100755 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -1574,7 +1574,7 @@ def test_kill_terminate(self): self.assertRaises(psutil.NoSuchProcess, proc.kill) self.assertRaises(psutil.NoSuchProcess, proc.send_signal, signal.SIGTERM) - if WINDOWS and sys.version_info >= (2, 7): + if WINDOWS: self.assertRaises(psutil.NoSuchProcess, proc.send_signal, signal.CTRL_C_EVENT) self.assertRaises(psutil.NoSuchProcess, proc.send_signal, diff --git a/psutil/tests/test_windows.py b/psutil/tests/test_windows.py index 7a843bc38..0333dbe55 100755 --- a/psutil/tests/test_windows.py +++ b/psutil/tests/test_windows.py @@ -338,8 +338,6 @@ def test_num_handles_increment(self): win32api.CloseHandle(handle) self.assertEqual(p.num_handles(), before) - @unittest.skipIf(not sys.version_info >= (2, 7), - "CTRL_* signals not supported") def test_ctrl_signals(self): p = psutil.Process(self.spawn_testproc().pid) p.send_signal(signal.CTRL_C_EVENT) diff --git a/scripts/internal/print_announce.py b/scripts/internal/print_announce.py index c9948c1d9..1c22b1c1d 100755 --- a/scripts/internal/print_announce.py +++ b/scripts/internal/print_announce.py @@ -47,7 +47,7 @@ nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It \ currently supports Linux, Windows, macOS, Sun Solaris, FreeBSD, OpenBSD, \ NetBSD and AIX, both 32-bit and 64-bit architectures. Supported Python \ -versions are 2.6, 2.7 and 3.4+. PyPy is also known to work. +versions are 2.7 and 3.4+. PyPy is also known to work. What's new ========== diff --git a/setup.py b/setup.py index 3bad6d5d5..250191c9d 100755 --- a/setup.py +++ b/setup.py @@ -392,7 +392,6 @@ def main(): 'Operating System :: POSIX', 'Programming Language :: C', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: Implementation :: CPython', @@ -414,7 +413,7 @@ def main(): ) if setuptools is not None: kwargs.update( - python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", extras_require=extras_require, zip_safe=False, )