Skip to content

Commit

Permalink
Drop Python 2.6 support (#2099)
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
  • Loading branch information
hugovk authored Apr 15, 2022
1 parent b135380 commit 6ab8a54
Show file tree
Hide file tree
Showing 24 changed files with 50 additions and 44 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.9
cache: pip
cache-dependency-path: .github/workflows/build.yml

- name: Install cibuildwheel
run: pip install cibuildwheel
Expand All @@ -63,7 +65,7 @@ jobs:
run: cibuildwheel .

- name: Create wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse
Expand Down Expand Up @@ -102,10 +104,12 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.9
cache: pip
cache-dependency-path: .github/workflows/build.yml

- name: Install cibuildwheel
run: pip install cibuildwheel==1.12.0
Expand All @@ -114,7 +118,7 @@ jobs:
run: cibuildwheel .

- name: Create wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse
Expand All @@ -135,7 +139,7 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run tests
id: test
Expand All @@ -157,8 +161,11 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
cache: pip
cache-dependency-path: .github/workflows/build.yml
- name: 'Run linters'
run: |
# py2
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
# install python
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.8
cache: pip
cache-dependency-path: .github/workflows/issues.yml
# install deps
- name: Install deps
run: python -m pip install --upgrade pip PyGithub
Expand Down
4 changes: 4 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -782,3 +782,7 @@ I: 1956
N: Matthieu Darbois
W: https://github.com/mayeut
I: 2039

N: Hugo van Kemenade
W: https://github.com/hugovk
I: 2099
4 changes: 2 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ XXXX-XX-XX

**Enhancements**

- 1053_: dropped support for Python 2.6. (patch by Matthieu Darbois)
- 1053_: dropped support for Python 2.6. (patches by Matthieu Darbois and Hugo van Kemenade)
- 2050_, [Linux]: increase ``read(2)`` buffer size from 1k to 32k when reading
``/proc`` pseudo files line by line. This should help having more consistent
results.
Expand All @@ -17,7 +17,7 @@ XXXX-XX-XX

- 2048_: ``AttributeError`` is raised if ``psutil.Error`` class is raised
manually and passed through ``str``.
- 2049_, [Linux]: `cpu_freq`_ erroneously returns ``curr`` value in GHz while
- 2049_, [Linux]: `cpu_freq()`_ erroneously returns ``curr`` value in GHz while
``min`` and ``max`` are in MHz.
- 2050_, [Linux]: `virtual_memory()`_ may raise ``ValueError`` if running in a
LCX container.
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ TSCRIPT = psutil/tests/runner.py

# Internal.
DEPS = \
argparse \
autoflake \
autopep8 \
check-manifest \
Expand All @@ -29,8 +28,7 @@ DEPS = \
PY2_DEPS = \
futures \
ipaddress \
mock \
unittest2
mock
DEPS += `$(PYTHON) -c \
"import sys; print('$(PY2_DEPS)' if sys.version_info[0] == 2 else '')"`
# "python3 setup.py build" can be parallelized on Python >= 3.6.
Expand Down
7 changes: 2 additions & 5 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 from 2.6 to 3.4+.
Works with Python versions 2.7 and 3.4+.
"""

from __future__ import division
Expand Down Expand Up @@ -380,10 +380,7 @@ def _init(self, pid, _ignore_nsp=False):
self._ident = (self.pid, self._create_time)

def __str__(self):
try:
info = collections.OrderedDict()
except AttributeError: # pragma: no cover
info = {} # Python 2.6
info = collections.OrderedDict()
info["pid"] = self.pid
if self._name:
info['name'] = self._name
Expand Down
11 changes: 6 additions & 5 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import textwrap
import threading
import time
import unittest
import warnings
from socket import AF_INET
from socket import AF_INET6
Expand All @@ -57,11 +58,6 @@
from psutil._compat import which


if PY3:
import unittest
else:
import unittest2 as unittest # requires "pip install unittest2"

try:
from unittest import mock # py3
except ImportError:
Expand Down Expand Up @@ -862,6 +858,11 @@ def __str__(self):
def runTest(self):
pass

@contextlib.contextmanager
def subTest(self, *args, **kw):
# fake it for python 2.7
yield


# monkey patch default unittest.TestCase
unittest.TestCase = TestCase
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_aix.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"""AIX specific tests."""

import re
import unittest

import psutil
from psutil import AIX
from psutil.tests import PsutilTestCase
from psutil.tests import sh
from psutil.tests import unittest


@unittest.skipIf(not AIX, "AIX only")
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_bsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import re
import time
import unittest

import psutil
from psutil import BSD
Expand All @@ -27,7 +28,6 @@
from psutil.tests import sh
from psutil.tests import spawn_testproc
from psutil.tests import terminate
from psutil.tests import unittest
from psutil.tests import which


Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import socket
import textwrap
import unittest
from contextlib import closing
from socket import AF_INET
from socket import AF_INET6
Expand Down Expand Up @@ -39,7 +40,6 @@
from psutil.tests import serialrun
from psutil.tests import skip_on_access_denied
from psutil.tests import tcp_socketpair
from psutil.tests import unittest
from psutil.tests import unix_socketpair
from psutil.tests import wait_for_file

Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import time
import traceback
import unittest

import psutil
from psutil import AIX
Expand Down Expand Up @@ -51,7 +52,6 @@
from psutil.tests import kernel_version
from psutil.tests import process_namespace
from psutil.tests import serialrun
from psutil.tests import unittest


# ===================================================================
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import struct
import textwrap
import time
import unittest
import warnings

import psutil
Expand All @@ -46,7 +47,6 @@
from psutil.tests import safe_rmpath
from psutil.tests import sh
from psutil.tests import skip_on_not_implemented
from psutil.tests import unittest
from psutil.tests import which


Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_memleaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import functools
import os
import unittest

import psutil
import psutil._common
Expand Down Expand Up @@ -50,7 +51,6 @@
from psutil.tests import spawn_testproc
from psutil.tests import system_namespace
from psutil.tests import terminate
from psutil.tests import unittest


cext = psutil._psplatform.cext
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import pickle
import socket
import stat
import unittest

import psutil
import psutil.tests
Expand Down Expand Up @@ -51,7 +52,6 @@
from psutil.tests import mock
from psutil.tests import reload_module
from psutil.tests import sh
from psutil.tests import unittest


# ===================================================================
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import re
import time
import unittest

import psutil
from psutil import MACOS
Expand All @@ -20,7 +21,6 @@
from psutil.tests import sh
from psutil.tests import spawn_testproc
from psutil.tests import terminate
from psutil.tests import unittest


if POSIX:
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import re
import subprocess
import time
import unittest

import psutil
from psutil import AIX
Expand All @@ -32,7 +33,6 @@
from psutil.tests import skip_on_access_denied
from psutil.tests import spawn_testproc
from psutil.tests import terminate
from psutil.tests import unittest
from psutil.tests import which


Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import textwrap
import time
import types
import unittest

import psutil
from psutil import AIX
Expand Down Expand Up @@ -62,7 +63,6 @@
from psutil.tests import sh
from psutil.tests import skip_on_access_denied
from psutil.tests import skip_on_not_implemented
from psutil.tests import unittest
from psutil.tests import wait_for_pid


Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_sunos.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"""Sun OS specific tests."""

import os
import unittest

import psutil
from psutil import SUNOS
from psutil.tests import PsutilTestCase
from psutil.tests import sh
from psutil.tests import unittest


@unittest.skipIf(not SUNOS, "SUNOS only")
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import socket
import sys
import time
import unittest

import psutil
from psutil import AIX
Expand Down Expand Up @@ -50,7 +51,6 @@
from psutil.tests import enum
from psutil.tests import mock
from psutil.tests import retry_on_failure
from psutil.tests import unittest


# ===================================================================
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import socket
import stat
import subprocess
import unittest

import psutil
import psutil.tests
Expand Down Expand Up @@ -48,7 +49,6 @@
from psutil.tests import system_namespace
from psutil.tests import tcp_socketpair
from psutil.tests import terminate
from psutil.tests import unittest
from psutil.tests import unix_socketpair
from psutil.tests import wait_for_file
from psutil.tests import wait_for_pid
Expand Down
Loading

0 comments on commit 6ab8a54

Please sign in to comment.