From 613df41253486d01beaaa38a7e6dc6729184c246 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 8 Jul 2020 19:31:08 +0100 Subject: [PATCH] Drop support for Python 2.7 It's dead, Jim. Signed-off-by: Stephen Finucane --- .travis.yml | 1 - git_pw/utils.py | 14 +++++++++----- requirements.txt | 1 - setup.cfg | 7 ++----- setup.py | 2 +- test-requirements.txt | 3 +-- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index b5b24c1..366bc13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python sudo: false cache: pip python: -- 2.7 - 3.5 - 3.6 - 3.7 diff --git a/git_pw/utils.py b/git_pw/utils.py index f486cab..29c9417 100644 --- a/git_pw/utils.py +++ b/git_pw/utils.py @@ -5,22 +5,24 @@ from __future__ import print_function import csv +import io import os import subprocess import sys import click -import six from tabulate import tabulate def ensure_str(s): if s is None: s = '' - elif not isinstance(s, (six.text_type, six.binary_type)): + elif isinstance(s, bytes): + s = s.decode('utf-8', 'strict') + elif not isinstance(s, str): s = str(s) - return six.ensure_str(s) + return s def trim(string, length=70): # type: (str, int) -> str @@ -68,7 +70,7 @@ def _tabulate(output, headers, fmt): elif fmt == 'simple': return tabulate(output, headers, tablefmt='simple') elif fmt == 'csv': - result = six.StringIO() + result = io.StringIO() writer = csv.writer( result, quoting=csv.QUOTE_ALL, lineterminator=os.linesep) writer.writerow([ensure_str(h) for h in headers]) @@ -89,7 +91,9 @@ def _echo_via_pager(pager, output): pager = subprocess.Popen(pager.split(), stdin=subprocess.PIPE, env=env) - output = six.ensure_binary(output) + # TODO(stephenfin): This is potential hangover from Python 2 days + if not isinstance(output, bytes): + output = output.encode('utf-8', 'strict') try: pager.communicate(input=output) diff --git a/requirements.txt b/requirements.txt index 704d6f4..3d22168 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,3 @@ click>=6.0,<8.0 requests>2.0,<3.0 tabulate>=0.8 arrow>=0.10 -six>=1.12 diff --git a/setup.cfg b/setup.cfg index 7e3d215..0a13fa5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,11 +5,11 @@ description-file = README.rst license = MIT License license_file = LICENSE classifiers = - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 Programming Language :: Python Development Status :: 4 - Beta Environment :: Console @@ -25,7 +25,7 @@ project_urls = Bug Tracker = https://github.com/getpatchwork/git-pw/issues Source Code = https://github.com/getpatchwork/git-pw Documentation = https://git-pw.readthedocs.io -python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +python_requires = >=3.5 [files] packages = @@ -34,6 +34,3 @@ packages = [entry_points] console_scripts = git-pw = git_pw.shell:cli - -[bist_wheel] -universal = 1 diff --git a/setup.py b/setup.py index aa2d8a0..aabe2c7 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from setuptools import setup diff --git a/test-requirements.txt b/test-requirements.txt index ad1b6f9..2d34789 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,3 @@ mock~=3.0.0 -pytest>=3.0,<6.0;python_version>='3.5' -pytest>=3.0,<5.0;python_version=='2.7' +pytest>=3.0,<6.0 pytest-cov~=2.5