Skip to content

Commit

Permalink
Merge 33e8b34 into f4c7d11
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz authored Mar 14, 2019
2 parents f4c7d11 + 33e8b34 commit 2213a99
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
language: python
dist: xenial
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
- 3.7
- 3.8-dev
- pypy2.7-6.0
- pypy3.5-6.0
install:
- pip install -U pip setuptools
- pip install -U zope.testrunner coverage coveralls
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CHANGES
1.3 (unreleased)
================

- Nothing changed yet.
- Add support for Python 3.7 and 3.8.


1.2 (2018-05-09)
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def read(*rnames):
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Utilities',
Expand All @@ -55,6 +57,7 @@ def read(*rnames):
install_requires=[
'zope.interface',
'setuptools',
'six',
],
extras_require=dict(test=['zope.testing']),
)
4 changes: 2 additions & 2 deletions src/martian/compat3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sys
import six
import types


Expand All @@ -8,7 +8,7 @@
CLASS_TYPES = (type,)


if sys.version_info[0] < 3:
if six.PY2:
str = unicode # NOQA
else:
str = str
8 changes: 4 additions & 4 deletions src/martian/directive.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import six
import sys
import inspect

Expand Down Expand Up @@ -262,12 +263,11 @@ def __init__(self, *args, **kw):
# To get a correct error message, we construct a function that has
# the same signature as factory(), but without "self".
def check_factory_signature(self, *arguments, **kw):
if sys.version_info.major == 2:
if six.PY2:
(args, varargs, varkw, defaults) = inspect.getargspec(self.factory)
argspec = inspect.formatargspec(args[1:], varargs, varkw, defaults)
else:
(args, varargs, varkw, defaults,
_, __, ___) = inspect.getfullargspec(self.factory)
argspec = inspect.formatargspec(args[1:], varargs, varkw, defaults)
argspec = str(inspect.signature(self.factory))
ns = dict()
exec("def signature_checker" + argspec + ": pass", dict(), ns)
try:
Expand Down
3 changes: 2 additions & 1 deletion src/martian/testing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import six
import sys
from types import ModuleType
from types import FunctionType
Expand Down Expand Up @@ -65,7 +66,7 @@ def __init__(cls, classname, bases, dict_):
return type.__init__(cls, classname, bases, dict_)


if sys.version_info[0] < 3:
if six.PY2:

class FakeModuleObject(object):
pass
Expand Down
9 changes: 3 additions & 6 deletions src/martian/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""

import re
import six
import sys
import inspect

Expand All @@ -26,18 +27,14 @@

def not_unicode_or_ascii(value):
# python3 compatibility
if sys.version_info < (3,) and isinstance(value, unicode): # NOQA
if six.PY2 and isinstance(value, unicode): # NOQA
return False
if not isinstance(value, str):
return True
return is_not_ascii(value)


# extra compatibility for python3.2
if sys.version_info < (3,):
is_not_ascii = re.compile(eval(r'u"[\u0080-\uffff]"')).search
else:
is_not_ascii = re.compile(eval(r'"[\u0080-\uffff]"')).search
is_not_ascii = re.compile(eval(r'u"[\u0080-\uffff]"')).search


def isclass(obj):
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ envlist =
py34,
py35,
py36,
py37,
py38,
pypy,
pypy3,
coverage-report
Expand Down

0 comments on commit 2213a99

Please sign in to comment.