Skip to content

Commit

Permalink
Drop support for Python 2 (#57)
Browse files Browse the repository at this point in the history
* Drop support for Python 2

* Added history entry
  • Loading branch information
joladev authored Feb 11, 2020
1 parent a856026 commit 1d05133
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 42 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ dist: xenial
language: python

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

matrix:
include:
- python: "2.6"
dist: trusty
env:
- REQUESTS="requests" # latest
- python: "3.7"
sudo: true
env:
Expand Down
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- [#59](https://github.com/castle/castle-python/pull/59) drop requests min version in ci

### Breaking Changes:

- [#57](https://github.com/castle/castle-python/pull/57) dropped support for python 2

## 2.4.0 (2019-11-20)

- [#53](https://github.com/castle/castle-python/pull/53) Update whitelisting and blacklisting behavior
Expand Down
6 changes: 1 addition & 5 deletions castle/headers_formatter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import sys


class HeadersFormatter(object):
Expand All @@ -9,7 +8,4 @@ def call(header):

@staticmethod
def split(header):
if sys.version_info[:2] == (2, 6):
return re.split(r'_|-', re.sub(re.compile(r'^HTTP(?:_|-)', re.IGNORECASE), '', header))
else:
return re.split(r'_|-', re.sub(r'^HTTP(?:_|-)', '', header, flags=re.IGNORECASE))
return re.split(r'_|-', re.sub(r'^HTTP(?:_|-)', '', header, flags=re.IGNORECASE))
23 changes: 2 additions & 21 deletions castle/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import logging
import sys
import unittest
from unittest import mock


# The unittest module got a significant overhaul
# in 2.7, so if we're in 2.6 we can use the backported
# version unittest2.
if sys.version_info[:2] == (2, 6):
# pylint: disable=import-error
import unittest2 as unittest
else:
import unittest


# Python 3 includes mocking, while 2 requires an extra module.
if sys.version_info[0] == 2:
# pylint: disable=import-error
import mock
else:
from unittest import mock

if sys.version_info[:2] == (2, 6):
import subprocess
subprocess.call(["sed", "-i", "-e", 's/import _io/import io as _io/g', "/home/travis/build/castle/castle-python/.eggs/responses-0.6.2-py2.6.egg/responses.py"])

TEST_MODULES = [
'castle.test.api_test',
'castle.test.client_test',
Expand Down
12 changes: 1 addition & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

try:
from setuptools import find_packages, setup
except ImportError:
Expand All @@ -8,11 +6,6 @@
from castle.version import VERSION


if sys.version_info[:2] == (2, 6):
tests_require = ['responses<0.7', 'unittest2']
else:
tests_require = ['responses']

setup(
name="castle",
version=VERSION,
Expand All @@ -29,9 +22,6 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
Expand All @@ -41,6 +31,6 @@
install_requires=[
'requests>=2.5',
],
tests_require=tests_require,
tests_require=['responses'],
test_suite='castle.test.all'
)

0 comments on commit 1d05133

Please sign in to comment.