summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Weis <g.weis@griffith.edu.au>2017-07-05 10:54:03 (GMT)
committerGerhard Weis <g.weis@griffith.edu.au>2017-07-05 10:54:03 (GMT)
commit0d0abd79a975ed132a8eb43783f87cd84eea9267 (patch)
tree733231867f0ff1ba3679e1d4564a1b2506353cb2
parent1dc3c2481ba32e9dbcad9e55d2c20281f5aa5756 (diff)
parent6e5802bf7b410551f1dfcaf6ede8638f0f233cad (diff)
downloadisodate-0d0abd79a975ed132a8eb43783f87cd84eea9267.tar.gz
Merge branch 'master' of https://github.com/lmazuel/isodate
# Conflicts: # .travis.yml # setup.cfg # src/isodate/tzinfo.py
-rw-r--r--.travis.yml35
-rw-r--r--setup.py15
-rw-r--r--src/isodate/isoduration.py4
-rw-r--r--src/isodate/isotime.py4
-rw-r--r--src/isodate/tests/test_pickle.py7
5 files changed, 32 insertions, 33 deletions
diff --git a/.travis.yml b/.travis.yml
index 4cf6c8a..fe73aed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,24 @@
-
language: python
-
-python:
- - 3.4
-
-env:
- - TOX_ENV=py26
- - TOX_ENV=py27
- - TOX_ENV=py33
- - TOX_ENV=py34
- - TOX_ENV=pypy
- - TOX_ENV=pypy3
- - TOX_ENV=flake
- - TOX_ENV=cover
-
+matrix:
+ include:
+ - python: 2.7
+ env: TOXENV=py27
+ - python: 3.3
+ env: TOXENV=py33
+ - python: 3.4
+ env: TOXENV=py34
+ - python: 3.5
+ env: TOXENV=py35
+ - python: 3.6
+ env: TOXENV=py36
+ - python: 3.4
+ env: TOXENV=flake
+ - python: 3.4
+ env: TOXENV=cover
install:
- pip install tox
-
script:
- - tox -e $TOX_ENV
-
+ - tox
after_script:
- if [ $TOX_ENV == "cover" ]; then
pip install --quiet coveralls;
diff --git a/setup.py b/setup.py
index fac49a0..e663b95 100644
--- a/setup.py
+++ b/setup.py
@@ -26,20 +26,10 @@
# CONTRACT, STRICT LIABILITY, OR TORT
##############################################################################
import os
-import sys
+from setuptools import setup
setupargs = {}
-
-try:
- from setuptools import setup
- setupargs['test_suite'] = 'isodate.tests.test_suite'
- if sys.version[0] == '3':
- setupargs['use_2to3'] = True
-except ImportError:
- from distutils.core import setup
- if sys.version[0] == '3':
- from distutils.command.build_py import build_py_2to3
- setupargs['cmdclass'] = {'build_py': build_py_2to3}
+setupargs['test_suite'] = 'isodate.tests.test_suite'
def read(*rnames):
@@ -72,7 +62,6 @@ setup(name='isodate',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
diff --git a/src/isodate/isoduration.py b/src/isodate/isoduration.py
index 6da69f5..d64b3c0 100644
--- a/src/isodate/isoduration.py
+++ b/src/isodate/isoduration.py
@@ -33,6 +33,7 @@ format timedelta or Duration instances as ISO conforming strings.
from datetime import timedelta
from decimal import Decimal
import re
+import sys
from isodate.duration import Duration
from isodate.isoerror import ISO8601Error
@@ -51,6 +52,9 @@ ISO8601_PERIOD_REGEX = re.compile(
r"(?P<seconds>[0-9]+([,.][0-9]+)?S)?)?$")
# regular expression to parse ISO duartion strings.
+if sys.version_info[0] >= 3:
+ basestring = str
+
def parse_duration(datestring):
"""
diff --git a/src/isodate/isotime.py b/src/isodate/isotime.py
index 9650cda..a430982 100644
--- a/src/isodate/isotime.py
+++ b/src/isodate/isotime.py
@@ -32,6 +32,7 @@ It supports all basic and extended formats including time zone specifications
as described in the ISO standard.
'''
import re
+import sys
from decimal import Decimal
from datetime import time
@@ -39,6 +40,9 @@ from isodate.isostrf import strftime, TIME_EXT_COMPLETE, TZ_EXT
from isodate.isoerror import ISO8601Error
from isodate.isotzinfo import TZ_REGEX, build_tzinfo
+if sys.version_info > (3,):
+ long = int
+
TIME_REGEX_CACHE = []
# used to cache regular expressions to parse ISO time strings.
diff --git a/src/isodate/tests/test_pickle.py b/src/isodate/tests/test_pickle.py
index 4b824e7..0d8c184 100644
--- a/src/isodate/tests/test_pickle.py
+++ b/src/isodate/tests/test_pickle.py
@@ -1,5 +1,8 @@
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
import unittest
-import cPickle as pickle
import isodate
@@ -31,7 +34,7 @@ class TestPickle(unittest.TestCase):
pikl = pickle.dumps(dur, proto)
if dur != pickle.loads(pikl):
raise Exception("not equal")
- except Exception, e:
+ except Exception as e:
failed.append("pickle proto %d failed (%s)" % (proto, repr(e)))
self.assertEqual(len(failed), 0, "pickle protos failed: %s" %
str(failed))