Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop python 3.4 & 3.5 support #2246

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.6+** and
`PyPy <http://pypy.org/>`__.

Funding
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.6+**.
`PyPy <http://pypy.org/>`__ is also known to work.

The psutil documentation you're reading is distributed as a single HTML page.
Expand Down Expand Up @@ -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.6+ and PyPy3.

Timeline
========
Expand Down
4 changes: 2 additions & 2 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Sun Solaris
- AIX
Works with Python versions 2.7 and 3.4+.
Works with Python versions 2.7 and 3.6+.
"""

from __future__ import division
Expand Down Expand Up @@ -2189,7 +2189,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 = _PY3
if has_enums:
import socket
rawlist = _psplatform.net_if_addrs()
Expand Down
7 changes: 4 additions & 3 deletions psutil/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
except ImportError:
AF_UNIX = None

if sys.version_info >= (3, 4):

# can't take it from _common.py as this script is imported by setup.py
PY3 = sys.version_info[0] == 3
if PY3:
import enum
else:
enum = None


# can't take it from _common.py as this script is imported by setup.py
PY3 = sys.version_info[0] == 3
PSUTIL_DEBUG = bool(os.getenv('PSUTIL_DEBUG'))
_DEFAULT = object()

Expand Down
2 changes: 1 addition & 1 deletion psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from ._compat import basestring


if sys.version_info >= (3, 4):
if PY3:
import enum
else:
enum = None
Expand Down
2 changes: 1 addition & 1 deletion psutil/_psposix.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from . import _psutil_osx


if sys.version_info >= (3, 4):
if PY3:
import enum
else:
enum = None
Expand Down
2 changes: 1 addition & 1 deletion psutil/_pswindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
else:
raise

if sys.version_info >= (3, 4):
if PY3:
import enum
else:
enum = None
Expand Down
5 changes: 1 addition & 4 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
warnings.simplefilter("ignore")
import mock # NOQA - requires "pip install mock"

if sys.version_info >= (3, 4):
if PY3:
import enum
else:
enum = None
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions psutil/tests/test_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import platform
import signal
import stat
import sys
import time
import traceback
import unittest
Expand All @@ -36,6 +35,7 @@
from psutil._compat import long
from psutil._compat import range
from psutil._compat import unicode
from psutil._compat import PY3
from psutil.tests import APPVEYOR
from psutil.tests import CI_TESTING
from psutil.tests import GITHUB_ACTIONS
Expand Down Expand Up @@ -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 PY3:
self.assertIsInstance(ret, enum.IntEnum)
else:
self.assertIsInstance(ret, int)
Expand Down
3 changes: 2 additions & 1 deletion psutil/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from psutil import WINDOWS
from psutil._compat import FileNotFoundError
from psutil._compat import long
from psutil._compat import PY3
from psutil.tests import ASCII_FS
from psutil.tests import CI_TESTING
from psutil.tests import DEVNULL
Expand Down Expand Up @@ -751,7 +752,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 PY3 and not PYPY:
self.assertIsInstance(addr.family, enum.IntEnum)
if nic_stats[nic].isup:
# Do not test binding to addresses of interfaces
Expand Down
2 changes: 1 addition & 1 deletion scripts/internal/print_announce.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.6+. PyPy is also known to work.
What's new
==========
Expand Down
9 changes: 4 additions & 5 deletions scripts/internal/winmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.*, !=3.5.*"),
extras_require=extras_require,
zip_safe=False,
)
Expand Down
Loading