Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.2
3.6.6
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
dist: xenial
language: python

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

matrix:
include:
- python: 3.7
dist: xenial
sudo: true

env:
- REQUESTS="requests" # latest
- REQUESTS="requests==2.5" # min version of requests library
Expand Down
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## master

- [#41](https://github.com/castle/castle-python/pull/41) add python 2.6, python 3.7

## 2.2.0 (2018-04-18)

### Breaking Changes:
Expand Down
6 changes: 5 additions & 1 deletion castle/headers_formatter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
import sys


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

@staticmethod
def split(header):
return re.split(r'_|-', re.sub(r'^HTTP(?:_|-)', '', header, flags=re.IGNORECASE))
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))
3 changes: 3 additions & 0 deletions castle/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
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',
Expand Down
16 changes: 14 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
from setuptools import find_packages, setup
import sys

try:
from setuptools import find_packages, setup
except ImportError:
from distutils.core import find_packages, setup

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 @@ -23,13 +33,15 @@
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
install_requires=[
'requests>=2.5',
],
tests_require=['responses'],
tests_require=tests_require,
test_suite='castle.test.all'
)