From 8d55e8697fafc0d513820821b744db804d4bd43f Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 22 Oct 2022 12:19:55 +0200 Subject: [PATCH] Drop Python 3.4 support Signed-off-by: mayeut --- README.rst | 2 +- docs/index.rst | 4 ++-- psutil/__init__.py | 4 ++-- psutil/_common.py | 2 +- psutil/_pslinux.py | 2 +- psutil/_psposix.py | 2 +- psutil/_pswindows.py | 2 +- psutil/tests/__init__.py | 5 +---- psutil/tests/test_contracts.py | 2 +- psutil/tests/test_system.py | 2 +- scripts/internal/print_announce.py | 2 +- scripts/internal/winmake.py | 9 ++++----- setup.py | 3 ++- 13 files changed, 19 insertions(+), 22 deletions(-) diff --git a/README.rst b/README.rst index 2e991cb354..fb668b2373 100644 --- a/README.rst +++ b/README.rst @@ -98,7 +98,7 @@ psutil currently supports the following platforms: - **Sun Solaris** - **AIX** -Supported Python versions are **2.7**, **3.4+** and +Supported Python versions are **2.7**, **3.5+** and `PyPy `__. Funding diff --git a/docs/index.rst b/docs/index.rst index 2bf050a11d..8250cbcb3e 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.7** and **3.4+**. +Supported Python versions are **2.7** and **3.5+**. `PyPy `__ is also known to work. The psutil documentation you're reading is distributed as a single HTML page. @@ -2632,7 +2632,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.7, 3.4+ and PyPy3. +Supported Python versions are 2.7, 3.5+ and PyPy3. Timeline ======== diff --git a/psutil/__init__.py b/psutil/__init__.py index 2b0b3c6b00..d506244cce 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -17,7 +17,7 @@ - Sun Solaris - AIX -Works with Python versions 2.7 and 3.4+. +Works with Python versions 2.7 and 3.5+. """ from __future__ import division @@ -2181,7 +2181,7 @@ def net_if_addrs(): Note: you can have more than one address of the same family associated with each interface. """ - has_enums = sys.version_info >= (3, 4) + has_enums = sys.version_info[0] >= 3 if has_enums: import socket rawlist = _psplatform.net_if_addrs() diff --git a/psutil/_common.py b/psutil/_common.py index 9228674648..85973dae0a 100644 --- a/psutil/_common.py +++ b/psutil/_common.py @@ -35,7 +35,7 @@ except ImportError: AF_UNIX = None -if sys.version_info >= (3, 4): +if sys.version_info[0] >= 3: import enum else: enum = None diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index d178fe1638..aaee9df86e 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -53,7 +53,7 @@ from ._compat import basestring -if sys.version_info >= (3, 4): +if sys.version_info[0] >= 3: import enum else: enum = None diff --git a/psutil/_psposix.py b/psutil/_psposix.py index 1d250bf75c..4cc63439c4 100644 --- a/psutil/_psposix.py +++ b/psutil/_psposix.py @@ -28,7 +28,7 @@ from . import _psutil_osx -if sys.version_info >= (3, 4): +if sys.version_info[0] >= 3: import enum else: enum = None diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index 4081aa17fb..2c8e41487c 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -56,7 +56,7 @@ else: raise -if sys.version_info >= (3, 4): +if sys.version_info[0] >= 3: import enum else: enum = None diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index e6f0abc356..13395dd7d9 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -67,7 +67,7 @@ warnings.simplefilter("ignore") import mock # NOQA - requires "pip install mock" -if sys.version_info >= (3, 4): +if sys.version_info[0] >= 3: import enum else: enum = None @@ -1714,9 +1714,6 @@ def import_module_by_path(path): if sys.version_info[0] == 2: import imp return imp.load_source(name, path) - elif sys.version_info[:2] <= (3, 4): - from importlib.machinery import SourceFileLoader - return SourceFileLoader(name, path).load_module() else: import importlib.util spec = importlib.util.spec_from_file_location(name, path) diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index 7f299a6243..b1a5af5665 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -723,7 +723,7 @@ def nice(self, ret, info): priorities = [getattr(psutil, x) for x in dir(psutil) if x.endswith('_PRIORITY_CLASS')] self.assertIn(ret, priorities) - if sys.version_info > (3, 4): + if sys.version_info[0] >= 3: self.assertIsInstance(ret, enum.IntEnum) else: self.assertIsInstance(ret, int) diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py index 414c86e99b..4d9dcd8486 100755 --- a/psutil/tests/test_system.py +++ b/psutil/tests/test_system.py @@ -751,7 +751,7 @@ def test_net_if_addrs(self): self.assertIsInstance(addr.netmask, (str, type(None))) self.assertIsInstance(addr.broadcast, (str, type(None))) self.assertIn(addr.family, families) - if sys.version_info >= (3, 4) and not PYPY: + if sys.version_info[0] >= 3 and not PYPY: self.assertIsInstance(addr.family, enum.IntEnum) if nic_stats[nic].isup: # Do not test binding to addresses of interfaces diff --git a/scripts/internal/print_announce.py b/scripts/internal/print_announce.py index 510dc15f64..f33150f6df 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.7 and 3.4+. PyPy is also known to work. +versions are 2.7 and 3.5+. PyPy is also known to work. What's new ========== diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index f92b2a8969..5ec2ecbfd2 100755 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -54,14 +54,13 @@ "wheel", ] -if sys.version_info[:2] >= (3, 5): - DEPS.append('flake8-bugbear') -if sys.version_info[:2] <= (2, 7): +if sys.version_info[0] == 2: DEPS.append('mock') -if sys.version_info[:2] <= (3, 2): DEPS.append('ipaddress') -if sys.version_info[:2] <= (3, 4): DEPS.append('enum34') +else: + DEPS.append('flake8-bugbear') + if not PYPY: DEPS.append("pywin32") DEPS.append("wmi") diff --git a/setup.py b/setup.py index 2b8b2abb22..ce9afc7349 100755 --- a/setup.py +++ b/setup.py @@ -444,7 +444,8 @@ def main(): ) if setuptools is not None: kwargs.update( - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + python_requires=( + ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"), extras_require=extras_require, zip_safe=False, )