[lxc-devel] [pylxd/master] Remove support for Python 2.7 and test 3.6, 3.7 and 3.8
d0ugal on Github
lxc-bot at linuxcontainers.org
Fri Dec 4 10:33:18 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201204/4830818b/attachment-0001.bin>
-------------- next part --------------
From b246823c108be95e0c0ff1e35d83003e1fae4584 Mon Sep 17 00:00:00 2001
From: Dougal Matthews <dougal at dougalmatthews.com>
Date: Fri, 4 Dec 2020 10:31:44 +0000
Subject: [PATCH] Remove support for Python 2.7 and test 3.6, 3.7 and 3.8
---
.travis.yml | 3 ++-
doc/source/contributing.rst | 4 ++--
pylxd/deprecated/connection.py | 14 ++++----------
pylxd/exceptions.py | 6 ------
pylxd/models/instance.py | 4 ----
requirements.txt | 1 -
setup.cfg | 5 ++---
setup.py | 8 --------
tox.ini | 2 +-
9 files changed, 11 insertions(+), 36 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7ad5fb71..70242a5e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,10 @@
language: python
python:
- "3.6"
+ - "3.7"
+ - "3.8"
env:
matrix:
- - TOXENV=py27
- TOXENV=py3
- TOXENV=lint
# - TOXENV=integration # requires a remote lxd setup
diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst
index 103be2b9..4eb8b402 100644
--- a/doc/source/contributing.rst
+++ b/doc/source/contributing.rst
@@ -78,7 +78,7 @@ Testing
Testing pyLXD is in 3 parts:
1. Conformance with `PEP 8`_, using the ``tox -e pep8`` command.
-2. Unit tests using ``tox -e py27`` and ``tox -e py3``.
+2. Unit tests using ``tox -e py3``.
3. Integration tests using the ``run_integration_tests`` script in the root of
the repository.
@@ -126,7 +126,7 @@ Some hints on how to run the integration tests:
1. On Ubuntu it's probably easiest to use the `Multipass`_ snap.
2. Launch an LTS instance using ``multipass launch -n foo``
3. Shell into the instance: ``multipass exec foo -- bash``
-4. Install tox and python2.7: ``sudo apt install python-tox python-2.7``
+4. Install tox and python3.6+: ``sudo apt install python-tox python3-dev``
5. Clone the branch from the PR (or otherwise copy the repo into the machine)
6. Configure LXD using ``lxd init`` -- follow the prompts provided.
7. Run the integration tests.
diff --git a/pylxd/deprecated/connection.py b/pylxd/deprecated/connection.py
index b2d27d08..cf5aaa3a 100644
--- a/pylxd/deprecated/connection.py
+++ b/pylxd/deprecated/connection.py
@@ -31,17 +31,11 @@
from pylxd.deprecated import exceptions, utils
-if hasattr(ssl, "SSLContext"):
- # For Python >= 2.7.9 and Python 3.x
- if hasattr(ssl, "PROTOCOL_TLSv1_2"):
- DEFAULT_TLS_VERSION = ssl.PROTOCOL_TLSv1_2
- else:
- DEFAULT_TLS_VERSION = ssl.PROTOCOL_TLSv1
+# For Python >= 2.7.9 and Python 3.x
+if hasattr(ssl, "PROTOCOL_TLSv1_2"):
+ DEFAULT_TLS_VERSION = ssl.PROTOCOL_TLSv1_2
else:
- # For Python 2.6 and <= 2.7.8
- from OpenSSL import SSL
-
- DEFAULT_TLS_VERSION = SSL.TLSv1_2_METHOD
+ DEFAULT_TLS_VERSION = ssl.PROTOCOL_TLSv1
class UnixHTTPConnection(http_client.HTTPConnection):
diff --git a/pylxd/exceptions.py b/pylxd/exceptions.py
index 605a4f14..941e348c 100644
--- a/pylxd/exceptions.py
+++ b/pylxd/exceptions.py
@@ -54,9 +54,3 @@ def __init__(self, name, *args, **kwargs):
class ClientConnectionFailed(Exception):
"""An exception raised when the Client connection fails."""
-
-
-if six.PY2:
-
- class NotADirectoryError(Exception):
- """ An exception raised when not a directory for python2 """
diff --git a/pylxd/models/instance.py b/pylxd/models/instance.py
index 47576b73..03acc6a0 100644
--- a/pylxd/models/instance.py
+++ b/pylxd/models/instance.py
@@ -35,10 +35,6 @@
from pylxd.models import _model as model
from pylxd.models.operation import Operation
-if six.PY2:
- # Python2.7 doesn't have this natively
- from pylxd.exceptions import NotADirectoryError
-
class InstanceState(object):
"""A simple object for representing instance state."""
diff --git a/requirements.txt b/requirements.txt
index bb3c981b..0e9fb89e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,4 +6,3 @@ requests>=2.20.0
requests-unixsocket>=0.1.5
requests-toolbelt>=0.8.0
cryptography!=1.3.0,>=1.0
-pyOpenSSL>=0.14;python_version<='2.7.8'
diff --git a/setup.cfg b/setup.cfg
index 6b0e25f3..5a750d74 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,11 +15,10 @@ classifier =
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
- Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
- Programming Language :: Python :: 3.4
- Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Programming Language :: Python :: 3.8
[files]
packages =
diff --git a/setup.py b/setup.py
index ddfcb924..8a58609b 100644
--- a/setup.py
+++ b/setup.py
@@ -16,14 +16,6 @@
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
-# In python < 2.7.4, a lazy loading of package `pbr` will break
-# setuptools if some other modules registered functions in `atexit`.
-# solution from: http://bugs.python.org/issue15881#msg170215
-try:
- import multiprocessing # noqa
-except ImportError:
- pass
-
setuptools.setup(
setup_requires=[
'pbr>=1.8',
diff --git a/tox.ini b/tox.ini
index 87ec2c60..75fe05e7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 1.6
-envlist = py3,py27,pypy,lint
+envlist = py3,pypy,lint
skipsdist = True
[testenv]
More information about the lxc-devel
mailing list