Skip to content

Commit

Permalink
Merge pull request pinterest#33 from jogo/PY38
Browse files Browse the repository at this point in the history
Drop Python 2.7 support and add 3.8 support
  • Loading branch information
jogo authored Jul 16, 2020
2 parents 319efa4 + a272c4c commit 02b10a3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, pypy2, pypy3]
python-version: [3.6, 3.7, 3.8, pypy3]

steps:
- uses: actions/checkout@v2
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Install Tox and any other packages
run: pip install tox
- name: Lint
if: matrix.python-version == '2.7' || matrix.python-version == '3.7'
if: matrix.python-version == '3.8'
run: |
pip install flake8
flake8 git_stacktrace
Expand Down
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

1.0.0
-----

* Add Python 3.8 support drop Python 2.7 support (https://github.com/pinterest/git-stacktrace/pull/33)

0.9.0
-----

Expand Down
11 changes: 3 additions & 8 deletions git_stacktrace/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import shlex
import os

import six
import whatthepatch

SHA1_REGEX = re.compile(r'\b[0-9a-f]{40}\b')
Expand Down Expand Up @@ -38,7 +37,7 @@ def __repr__(self):
return self.filename

def __eq__(self, other):
if isinstance(other, six.string_types):
if isinstance(other, str):
other_filename = other
else:
other_filename = other.filename
Expand All @@ -47,11 +46,7 @@ def __eq__(self, other):

def run_command_status(*argv, **kwargs):
if len(argv) == 1:
# for python2 compatibility with shlex
if sys.version_info < (3,) and isinstance(argv[0], six.text_type):
argv = shlex.split(argv[0].encode('utf-8'))
else:
argv = shlex.split(str(argv[0]))
argv = shlex.split(str(argv[0]))
stdin = kwargs.pop('stdin', None)
newenv = os.environ.copy()
newenv['LANG'] = 'C'
Expand Down Expand Up @@ -105,7 +100,7 @@ def pickaxe(snippet, git_range, filename=None):
Return list of commits that modified that snippet
"""
cmd = 'git', 'log', '-b', '--pretty=%H', '-S', six.u(snippet), git_range
cmd = 'git', 'log', '-b', '--pretty=%H', '-S', str(snippet), git_range
if filename:
cmd = cmd + ('--', filename,)
commits = run_command(*cmd).splitlines()
Expand Down
7 changes: 2 additions & 5 deletions git_stacktrace/parse_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import re
import traceback

import six

log = logging.getLogger(__name__)


Expand All @@ -35,8 +33,7 @@ def traceback_format(self):
return (self.trace_filename, self.line_number, self.function_name, self.code)


@six.add_metaclass(abc.ABCMeta)
class Traceback(object):
class Traceback(object, metaclass=abc.ABCMeta):

def __init__(self, blob):
self.header = ""
Expand All @@ -52,7 +49,7 @@ def prep_blob(self, blob):
if len(blob) == 1:
blob = blob[0].replace('\\n', '\n').split('\n')
# Split by line
if type(blob) == str or type(blob) == six.text_type:
if isinstance(blob, str):
lines = blob.split('\n')
elif type(blob) == list:
if len(blob) == 1:
Expand Down
6 changes: 3 additions & 3 deletions git_stacktrace/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import logging
import os

from cgi import escape
from html import escape
from git_stacktrace import api
from six.moves.html_parser import HTMLParser
from six.moves.urllib_parse import parse_qs
from html.parser import HTMLParser
from urllib.parse import parse_qs
from string import Template
from datetime import date, datetime

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
whatthepatch
six
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name = git-stacktrace
author = Joe Gordon
license = Apache License (2.0)
classifier =
Programming Language :: Python :: 2
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
Intended Audience :: Developers
Operating System :: OS Independent
License :: OSI Approved :: Apache Software License
Expand Down
9 changes: 1 addition & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
[tox]
minversion = 2.0
envlist=py27,py37,flake8,docs
envlist=py37,py38,flake8,docs
skipsdist=False

[travis]
python =
2.7: py27, flake8, docs
3.5: py35, flake8, docs
3.6: py36, flake8, docs
3.7: py37, flake8, docs

[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
Expand Down

0 comments on commit 02b10a3

Please sign in to comment.