diff options
| author | Jörn Hees <joernhees@users.noreply.github.com> | 2015-09-24 10:40:49 +0200 |
|---|---|---|
| committer | Jörn Hees <joernhees@users.noreply.github.com> | 2015-09-24 10:40:49 +0200 |
| commit | 12596d839fce8e93ee1bc91cb257a4df11924b4e (patch) | |
| tree | 1ed4b464c7eb09ac9c3713093297edd5e7318b60 | |
| parent | c9ebcafefe3c34dc0cdfe02909dd2ca7d9e0de93 (diff) | |
| parent | b8e6633b2c95d6690380e14126ecac1ebfab96e4 (diff) | |
| download | rdflib-12596d839fce8e93ee1bc91cb257a4df11924b4e.tar.gz | |
Merge pull request #526 from joernhees/py35
adding python 3.5 support
| -rw-r--r-- | .travis.yml | 1 | ||||
| -rw-r--r-- | rdflib/plugins/sparql/operators.py | 10 | ||||
| -rw-r--r-- | setup.py | 1 | ||||
| -rw-r--r-- | tox.ini | 22 |
4 files changed, 30 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index a23b677e..616c79a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ python: # - 3.2 - 3.3 - 3.4 + - 3.5 # - "pypy" before_install: diff --git a/rdflib/plugins/sparql/operators.py b/rdflib/plugins/sparql/operators.py index 7fa840dc..0179c6fb 100644 --- a/rdflib/plugins/sparql/operators.py +++ b/rdflib/plugins/sparql/operators.py @@ -6,6 +6,7 @@ using setEvalFn """ +import sys import re import math import random @@ -234,7 +235,7 @@ def Builtin_REPLACE(expr, ctx): # Now this is ugly. # Python has a "feature" where unmatched groups return None # then re.sub chokes on this. - # see http://bugs.python.org/issue1519638 + # see http://bugs.python.org/issue1519638 , fixed and errs in py3.5 # this works around and hooks into the internal of the re module... @@ -260,7 +261,12 @@ def Builtin_REPLACE(expr, ctx): cFlag = reduce(pyop.or_, [flagMap.get(f, 0) for f in flags]) # @@FIXME@@ either datatype OR lang, NOT both - return Literal(re.sub(unicode(pattern), _r, text, cFlag), + + # this is necessary due to different treatment of unmatched groups in + # python versions. see comments above in _r(m). + compat_r = unicode(replacement) if sys.version_info[:2] >= (3, 5) else _r + + return Literal(re.sub(unicode(pattern), compat_r, text, cFlag), datatype=text.datatype, lang=text.language) @@ -123,6 +123,7 @@ setup( "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", "License :: OSI Approved :: BSD License", "Topic :: Software Development :: Libraries :: Python Modules", "Operating System :: OS Independent", @@ -1,9 +1,9 @@ [tox] envlist = - py25,py26,py27,py32,py33,py34 + py25,py26,py27,py32,py33,py34,py35 [testenv] -setenv = +setenv = BERKELEYDB_DIR = /usr commands = {envpython} setup.py clean --all @@ -105,6 +105,24 @@ deps = html5lib SPARQLWrapper>=1.6.2 +[testenv:py35] +basepython = + python3.5 +commands = + python setup.py clean --all + python setup.py build + nosetests --where=./build/src \ + --with-doctest \ + --doctest-extension=.doctest \ + --doctest-tests +deps = + nose + isodate + pyparsing + bsddb3 + html5lib + SPARQLWrapper>=1.6.2 + [testenv:pypy] basepython = |
