From 8333a7d7136e2c7aa1f604c7b96c61d1a38ce82b Mon Sep 17 00:00:00 2001 From: Tomasz Pajor Date: Tue, 4 Sep 2018 16:50:56 +0200 Subject: [PATCH 1/6] switch dist to xenial --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 37bfc10..71ea64a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: xenial language: python python: From 1d335bc3d3526c919daad3108df93b234f7fa49d Mon Sep 17 00:00:00 2001 From: Tomasz Pajor Date: Tue, 4 Sep 2018 16:34:06 +0200 Subject: [PATCH 2/6] use python 3.6 locally --- .python-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.python-version b/.python-version index b727628..4f2c1d1 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.6.2 +3.6.6 From fa4733ebbbcffb85c2dd12a06dd164e7d47a7021 Mon Sep 17 00:00:00 2001 From: Tomasz Pajor Date: Tue, 4 Sep 2018 16:35:55 +0200 Subject: [PATCH 3/6] add python 3.7 --- .travis.yml | 6 ++++++ setup.py | 1 + 2 files changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 71ea64a..53a6f2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,12 @@ python: - "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 diff --git a/setup.py b/setup.py index 67d10be..f9cab8b 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ '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', From edfd65f025400231d224f7dcf11031ff14e513ce Mon Sep 17 00:00:00 2001 From: Tomasz Pajor Date: Tue, 4 Sep 2018 16:36:11 +0200 Subject: [PATCH 4/6] we support python 3.3 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index f9cab8b..399097a 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,7 @@ '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', From 36587179117a75d38853949b78482d004563dcb2 Mon Sep 17 00:00:00 2001 From: Tomasz Pajor Date: Tue, 4 Sep 2018 17:49:11 +0200 Subject: [PATCH 5/6] add python 2.6 --- .travis.yml | 1 + castle/headers_formatter.py | 6 +++++- castle/test/__init__.py | 3 +++ setup.py | 14 ++++++++++++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53a6f2e..87c5ad0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ dist: xenial language: python python: + - "2.6" - "2.7" - "3.3" - "3.4" diff --git a/castle/headers_formatter.py b/castle/headers_formatter.py index 5f297b0..62370a3 100644 --- a/castle/headers_formatter.py +++ b/castle/headers_formatter.py @@ -1,4 +1,5 @@ import re +import sys class HeadersFormatter(object): @@ -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)) diff --git a/castle/test/__init__.py b/castle/test/__init__.py index bd49868..bac6064 100644 --- a/castle/test/__init__.py +++ b/castle/test/__init__.py @@ -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', diff --git a/setup.py b/setup.py index 399097a..ea33ab0 100644 --- a/setup.py +++ b/setup.py @@ -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, @@ -32,6 +42,6 @@ install_requires=[ 'requests>=2.5', ], - tests_require=['responses'], + tests_require=tests_require, test_suite='castle.test.all' ) From 3b0bf18ea90014223e1d4664035227ba026b899f Mon Sep 17 00:00:00 2001 From: Tomasz Pajor Date: Tue, 4 Sep 2018 18:32:57 +0200 Subject: [PATCH 6/6] update changelog --- HISTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 9c80914..e712c30 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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: