Skip to content

Commit 613df41

Browse files
committed
Drop support for Python 2.7
It's dead, Jim. Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 2a1a229 commit 613df41

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: python
22
sudo: false
33
cache: pip
44
python:
5-
- 2.7
65
- 3.5
76
- 3.6
87
- 3.7

git_pw/utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@
55
from __future__ import print_function
66

77
import csv
8+
import io
89
import os
910
import subprocess
1011
import sys
1112

1213
import click
13-
import six
1414
from tabulate import tabulate
1515

1616

1717
def ensure_str(s):
1818
if s is None:
1919
s = ''
20-
elif not isinstance(s, (six.text_type, six.binary_type)):
20+
elif isinstance(s, bytes):
21+
s = s.decode('utf-8', 'strict')
22+
elif not isinstance(s, str):
2123
s = str(s)
2224

23-
return six.ensure_str(s)
25+
return s
2426

2527

2628
def trim(string, length=70): # type: (str, int) -> str
@@ -68,7 +70,7 @@ def _tabulate(output, headers, fmt):
6870
elif fmt == 'simple':
6971
return tabulate(output, headers, tablefmt='simple')
7072
elif fmt == 'csv':
71-
result = six.StringIO()
73+
result = io.StringIO()
7274
writer = csv.writer(
7375
result, quoting=csv.QUOTE_ALL, lineterminator=os.linesep)
7476
writer.writerow([ensure_str(h) for h in headers])
@@ -89,7 +91,9 @@ def _echo_via_pager(pager, output):
8991

9092
pager = subprocess.Popen(pager.split(), stdin=subprocess.PIPE, env=env)
9193

92-
output = six.ensure_binary(output)
94+
# TODO(stephenfin): This is potential hangover from Python 2 days
95+
if not isinstance(output, bytes):
96+
output = output.encode('utf-8', 'strict')
9397

9498
try:
9599
pager.communicate(input=output)

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ click>=6.0,<8.0
22
requests>2.0,<3.0
33
tabulate>=0.8
44
arrow>=0.10
5-
six>=1.12

setup.cfg

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ description-file = README.rst
55
license = MIT License
66
license_file = LICENSE
77
classifiers =
8-
Programming Language :: Python :: 2.7
98
Programming Language :: Python :: 3
109
Programming Language :: Python :: 3.5
1110
Programming Language :: Python :: 3.6
1211
Programming Language :: Python :: 3.7
12+
Programming Language :: Python :: 3.8
1313
Programming Language :: Python
1414
Development Status :: 4 - Beta
1515
Environment :: Console
@@ -25,7 +25,7 @@ project_urls =
2525
Bug Tracker = https://github.com/getpatchwork/git-pw/issues
2626
Source Code = https://github.com/getpatchwork/git-pw
2727
Documentation = https://git-pw.readthedocs.io
28-
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
28+
python_requires = >=3.5
2929

3030
[files]
3131
packages =
@@ -34,6 +34,3 @@ packages =
3434
[entry_points]
3535
console_scripts =
3636
git-pw = git_pw.shell:cli
37-
38-
[bist_wheel]
39-
universal = 1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
from setuptools import setup
44

test-requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
mock~=3.0.0
2-
pytest>=3.0,<6.0;python_version>='3.5'
3-
pytest>=3.0,<5.0;python_version=='2.7'
2+
pytest>=3.0,<6.0
43
pytest-cov~=2.5

0 commit comments

Comments
 (0)