From c9a5abaa8efd59bd3a3fa2e4faa717be82befc06 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sun, 12 Jan 2020 02:27:19 -0600 Subject: [PATCH] Drop py27 support This bumps jobs to the current usurri template and drops compatibility code for Python 2.7. Change-Id: Ida03f9cca7d276ed8a449d21c0ba58330916e7d9 Signed-off-by: Sean McGinnis --- .zuul.yaml | 3 +-- renderspec/__init__.py | 2 -- renderspec/contextfuncs.py | 2 -- renderspec/utils.py | 10 +++------- renderspec/versions.py | 2 -- requirements.txt | 1 - setup.cfg | 2 -- tox.ini | 6 ++---- 8 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 02f577e..980f881 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,5 +1,4 @@ - project: templates: - - openstack-python-jobs - - openstack-python3-train-jobs + - openstack-python3-ussuri-jobs - publish-openstack-docs-pti diff --git a/renderspec/__init__.py b/renderspec/__init__.py index a31e5fd..890cf1b 100644 --- a/renderspec/__init__.py +++ b/renderspec/__init__.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import argparse import os import platform diff --git a/renderspec/contextfuncs.py b/renderspec/contextfuncs.py index e4f2320..4fe701d 100644 --- a/renderspec/contextfuncs.py +++ b/renderspec/contextfuncs.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import os from jinja2 import contextfilter diff --git a/renderspec/utils.py b/renderspec/utils.py index 77040ab..2b29488 100644 --- a/renderspec/utils.py +++ b/renderspec/utils.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - from contextlib import closing from contextlib import contextmanager from email.parser import HeaderParser @@ -23,17 +21,15 @@ import os import shutil import tarfile import tempfile +import urllib import zipfile -import six -from six.moves.urllib.request import urlopen - def _download_file(url, dest_dir, dest_filename): """download a given url to a given destination directory and destination filenamee""" filename = os.path.join(dest_dir, dest_filename) - with closing(urlopen(url)) as response: # nosec + with closing(urllib.urlopen(url)) as response: # nosec with open(filename, 'wb') as f: while True: buf = response.read(8192) @@ -68,7 +64,7 @@ def _extract_archive_to_tempdir(archive_filename): def _find_archives(directories, basename): """return a list of archives in the given directories or an empty list if no archive(s) can be found""" - if isinstance(directories, six.string_types): + if isinstance(directories, str): directories = [directories] return sorted( diff --git a/renderspec/versions.py b/renderspec/versions.py index b7d888b..a3d77c3 100644 --- a/renderspec/versions.py +++ b/renderspec/versions.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - from packaging.requirements import Requirement from packaging.version import Version diff --git a/requirements.txt b/requirements.txt index 0a7ecf5..59b6851 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,3 @@ pymod2pkg!=0.8.0,>=0.7.0 # Apache-2.0 Jinja2>=2.10 # BSD License (3 clause) PyYAML>=3.10 # MIT packaging>=16.5 # Apache-2.0 -six>=1.10.0 # MIT diff --git a/setup.cfg b/setup.cfg index d789975..f8e146f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,8 +14,6 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 diff --git a/tox.ini b/tox.ini index 1fe64ab..035f818 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,11 @@ [tox] -envlist = py27,py37,pypy,pep8 +envlist = py37,pypy,pep8 minversion = 2.0 skipsdist = True [testenv] usedevelop = True +basepython = python3 install_command = pip install {opts} {packages} setenv = VIRTUAL_ENV={envdir} OS_STDOUT_NOCAPTURE=False @@ -17,7 +18,6 @@ deps = commands = stestr run {posargs} [testenv:pep8] -basepython = python3 deps = {[testenv]deps} flake8<3.8.0,>=3.7.0 bandit>=1.1.0 @@ -26,14 +26,12 @@ commands = bandit -r -s B701 renderspec -x tests [testenv:venv] -basepython = python3 commands = {posargs} [flake8] exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build [testenv:docs] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = python setup.py build_sphinx