Commit d2430502 authored by Éloi Rivard's avatar Éloi Rivard

Stop support for python<3.7

parent 250d9ed7
...@@ -8,6 +8,8 @@ Change Log ...@@ -8,6 +8,8 @@ Change Log
- Stop support for ZODB4 - Stop support for ZODB4
- Stop support for python<3.7
2.5.0 (2021-05-12) 2.5.0 (2021-05-12)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
# -*- coding: utf-8 -*-
# #
# zodburi documentation build configuration file # zodburi documentation build configuration file
# #
......
...@@ -7,14 +7,14 @@ Overview ...@@ -7,14 +7,14 @@ Overview
A library which parses URIs and converts them to ZODB storage objects and A library which parses URIs and converts them to ZODB storage objects and
database arguments. database arguments.
It will run under CPython 2.7, 3.5 to 3.8, pypy and pypy3. It will not run under Jython. It requires ZODB >= 5.0.0. It will run under CPython 3.7+ and pypy3. It will not run under Jython. It requires ZODB >= 5.0.0.
Installation Installation
------------ ------------
Install using setuptools, e.g. (within a virtualenv):: Install using pip, e.g. (within a virtualenv)::
$ easy_install zodburi $ pip install zodburi
Using Using
----- -----
......
...@@ -8,13 +8,13 @@ here = os.path.abspath(os.path.dirname(__file__)) ...@@ -8,13 +8,13 @@ here = os.path.abspath(os.path.dirname(__file__))
try: try:
with open(os.path.join(here, 'README.rst')) as f: with open(os.path.join(here, 'README.rst')) as f:
README = f.read() README = f.read()
except IOError: except OSError:
README = '' README = ''
try: try:
with open(os.path.join(here, 'CHANGES.rst')) as f: with open(os.path.join(here, 'CHANGES.rst')) as f:
CHANGES = f.read() CHANGES = f.read()
except IOError: except OSError:
CHANGES = '' CHANGES = ''
requires = ['ZODB', 'ZConfig', 'ZEO'] requires = ['ZODB', 'ZConfig', 'ZEO']
...@@ -33,13 +33,12 @@ setup(name='zodburi', ...@@ -33,13 +33,12 @@ setup(name='zodburi',
classifiers=[ classifiers=[
"Intended Audience :: Developers", "Intended Audience :: Developers",
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
"License :: Repoze Public License", "License :: Repoze Public License",
......
[tox] [tox]
envlist = envlist =
py27,py35,py36,py37,py38,pypy,pypy3,cover,docs,lint py37,py38,py39,py310,py311,pypy3,cover,docs,lint
[testenv] [testenv]
commands = commands =
...@@ -12,7 +12,7 @@ deps = ...@@ -12,7 +12,7 @@ deps =
[testenv:cover] [testenv:cover]
basepython = basepython =
python3.7 python3.9
commands = commands =
python setup.py nosetests --with-xunit --with-xcoverage python setup.py nosetests --with-xunit --with-xcoverage
deps = deps =
...@@ -29,7 +29,7 @@ deps = ...@@ -29,7 +29,7 @@ deps =
[testenv:docs] [testenv:docs]
basepython = basepython =
python3.7 python3.11
commands = commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
deps = deps =
......
...@@ -35,7 +35,7 @@ parameters = dict(database_name = 'database_name') ...@@ -35,7 +35,7 @@ parameters = dict(database_name = 'database_name')
for parameter in connection_parameters: for parameter in connection_parameters:
parameters['connection_' + parameter] = parameter parameters['connection_' + parameter] = parameter
has_units = re.compile('\s*(\d+)\s*([kmg])b\s*$').match has_units = re.compile(r'\s*(\d+)\s*([kmg])b\s*$').match
units = dict(k=1<<10, m=1<<20, g=1<<30) units = dict(k=1<<10, m=1<<20, g=1<<30)
def _parse_bytes(s): def _parse_bytes(s):
m = has_units(s.lower()) m = has_units(s.lower())
......
# -*- coding: utf-8 -*-
from io import BytesIO from io import BytesIO
import os import os
import re import re
...@@ -19,11 +18,8 @@ from zodburi._compat import parse_qsl ...@@ -19,11 +18,8 @@ from zodburi._compat import parse_qsl
from zodburi._compat import urlsplit from zodburi._compat import urlsplit
from zodburi import _resolve_uri from zodburi import _resolve_uri
# Capability test for older Pythons (2.x < 2.7.4, 3.x < 3.2.4)
(scheme, netloc, path, query, frag) = urlsplit('scheme:///path/#frag')
_BROKEN_URLSPLIT = frag != 'frag'
class Resolver(object): class Resolver:
_int_args = () _int_args = ()
_string_args = () _string_args = ()
_bytesize_args = () _bytesize_args = ()
...@@ -161,7 +157,7 @@ class ClientStorageURIResolver(Resolver): ...@@ -161,7 +157,7 @@ class ClientStorageURIResolver(Resolver):
return factory, unused return factory, unused
class ZConfigURIResolver(object): class ZConfigURIResolver:
schema_xml_template = b""" schema_xml_template = b"""
<schema> <schema>
...@@ -173,11 +169,6 @@ class ZConfigURIResolver(object): ...@@ -173,11 +169,6 @@ class ZConfigURIResolver(object):
def __call__(self, uri): def __call__(self, uri):
(scheme, netloc, path, query, frag) = urlsplit(uri) (scheme, netloc, path, query, frag) = urlsplit(uri)
if _BROKEN_URLSPLIT: #pragma NO COVER
# urlsplit used not to allow fragments in non-standard schemes,
# stuffed everything into 'path'
(scheme, netloc, path, query, frag
) = urlsplit('http:' + path)
path = os.path.normpath(path) path = os.path.normpath(path)
schema_xml = self.schema_xml_template schema_xml = self.schema_xml_template
schema = loadSchemaFile(BytesIO(schema_xml)) schema = loadSchemaFile(BytesIO(schema_xml))
...@@ -208,7 +199,7 @@ class ZConfigURIResolver(object): ...@@ -208,7 +199,7 @@ class ZConfigURIResolver(object):
return factory.open, dbkw return factory.open, dbkw
class DemoStorageURIResolver(object): class DemoStorageURIResolver:
# demo:(base_uri)/(δ_uri)#dbkw... # demo:(base_uri)/(δ_uri)#dbkw...
# URI format follows XRI Cross-references to refer to base and δ # URI format follows XRI Cross-references to refer to base and δ
......
import mock from unittest import mock
import unittest import unittest
......
import mock from unittest import mock
import pkg_resources import pkg_resources
import unittest import unittest
...@@ -208,8 +208,8 @@ class TestFileStorageURIResolver(Base, unittest.TestCase): ...@@ -208,8 +208,8 @@ class TestFileStorageURIResolver(Base, unittest.TestCase):
def test_dbargs(self): def test_dbargs(self):
resolver = self._makeOne() resolver = self._makeOne()
factory, dbkw = resolver( factory, dbkw = resolver(
('file:///tmp/../foo/bar?connection_pool_size=1' 'file:///tmp/../foo/bar?connection_pool_size=1'
'&connection_cache_size=1&database_name=dbname')) '&connection_cache_size=1&database_name=dbname')
self.assertEqual(dbkw, {'connection_cache_size': '1', self.assertEqual(dbkw, {'connection_cache_size': '1',
'connection_pool_size': '1', 'connection_pool_size': '1',
'database_name': 'dbname'}) 'database_name': 'dbname'})
...@@ -487,7 +487,7 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -487,7 +487,7 @@ class TestZConfigURIResolver(unittest.TestCase):
database-name foo database-name foo
%s %s
</zodb> </zodb>
""" % '\n'.join("%s %s" % ( """ % '\n'.join("{} {}".format(
name.replace('_', '-'), name.replace('_', '-'),
'%sMB' % i if name in bytes_parameters else i, '%sMB' % i if name in bytes_parameters else i,
) )
...@@ -587,7 +587,7 @@ class TestDemoStorageURIResolver(unittest.TestCase): ...@@ -587,7 +587,7 @@ class TestDemoStorageURIResolver(unittest.TestCase):
changef = os.path.join(tmpdir, 'changes.fs') changef = os.path.join(tmpdir, 'changes.fs')
self.assertFalse(os.path.exists(basef)) self.assertFalse(os.path.exists(basef))
self.assertFalse(os.path.exists(changef)) self.assertFalse(os.path.exists(changef))
factory, dbkw = resolver('demo:(file://%s)/(file://%s?quota=200)' % (basef, changef)) factory, dbkw = resolver('demo:(file://{})/(file://{}?quota=200)'.format(basef, changef))
self.assertEqual(dbkw, {}) self.assertEqual(dbkw, {})
demo = factory() demo = factory()
from ZODB.DemoStorage import DemoStorage from ZODB.DemoStorage import DemoStorage
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment