Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2a604f

Browse files
committed
Switch to vcversioner, use repoze.lru only on 2.6, and add extras_require for format.
1 parent 5f91ee6 commit e2a604f

7 files changed

Lines changed: 27 additions & 41 deletions

File tree

.gitignore

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
.DS_Store
2-
.idea
3-
4-
*.pyc
5-
*.pyo
6-
7-
*.egg-info
8-
_build
9-
build
10-
dist
11-
MANIFEST
12-
13-
.coverage
14-
.coveragerc
15-
coverage
16-
htmlcov
17-
181
_cache
192
_static
203
_templates
214

22-
_trial_temp
23-
24-
.tox
25-
265
TODO
6+
7+
jsonschema/_version.py

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include *.rst
22
include COPYING
33
include tox.ini
4+
include version.txt
45
recursive-include json *

jsonschema/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
Draft3Validator, Draft4Validator, RefResolver, validate
2020
)
2121

22-
from jsonschema.version import __version__
22+
from jsonschema._version import __version__
2323

2424
# flake8: noqa

jsonschema/compat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from collections.abc import MutableMapping, Sequence # noqa
1111

1212
PY3 = sys.version_info[0] >= 3
13+
PY26 = sys.version_info[:2] == (2, 6)
1314

1415
if PY3:
1516
zip = zip
@@ -24,7 +25,6 @@
2425
iteritems = operator.methodcaller("items")
2526
else:
2627
from itertools import izip as zip # noqa
27-
from repoze.lru import lru_cache
2828
from StringIO import StringIO
2929
from urlparse import (
3030
urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit # noqa
@@ -35,6 +35,11 @@
3535
int_types = int, long
3636
iteritems = operator.methodcaller("iteritems")
3737

38+
if PY26:
39+
from repoze.lru import lru_cache
40+
else:
41+
from functools32 import lru_cache
42+
3843

3944
# On python < 3.3 fragments are not handled properly with unknown schemes
4045
def urlsplit(url):

jsonschema/version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import os.path
2-
from setuptools import setup
1+
import os
32
import sys
43

5-
# Load __version__ info globals without importing anything
6-
with open(
7-
os.path.join(os.path.dirname(__file__), 'jsonschema', 'version.py')
8-
) as fh:
9-
exec(fh.read())
4+
from setuptools import setup
5+
106

11-
with open("README.rst") as readme:
7+
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
128
long_description = readme.read()
139

1410
classifiers = [
@@ -26,16 +22,22 @@
2622
"Programming Language :: Python :: Implementation :: PyPy",
2723
]
2824

29-
install_requires = []
3025

31-
if sys.version_info < (3, 2):
32-
install_requires.append('repoze.lru >= 0.6')
26+
extras_require = {"format" : ["rfc3987", "strict-rfc3339", "webcolors"]}
27+
if sys.version_info[:2] == (2, 6):
28+
install_requires = ["argparse", "repoze.lru"]
29+
elif sys.version_info[:2] == (2, 7):
30+
install_requires = ["functools32"]
31+
else:
32+
install_requires = []
3333

3434
setup(
3535
name="jsonschema",
36-
version=__version__,
3736
packages=["jsonschema", "jsonschema.tests"],
3837
package_data={"jsonschema": ["schemas/*.json"]},
38+
setup_requires=["vcversioner"],
39+
install_requires=install_requires,
40+
extras_require=extras_require,
3941
author="Julian Berman",
4042
author_email="[email protected]",
4143
classifiers=classifiers,
@@ -44,5 +46,5 @@
4446
long_description=long_description,
4547
url="http://github.com/Julian/jsonschema",
4648
entry_points={"console_scripts": ["jsonschema = jsonschema.cli:main"]},
47-
install_requires=install_requires,
49+
vcversioner={"version_module_paths" : ["jsonschema/_version.py"]},
4850
)

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ commands =
1010
py{26,27,34,py}: sphinx-build -b doctest {toxinidir}/docs {envtmpdir}/html
1111
deps =
1212
pytest
13-
strict-rfc3339
14-
webcolors
15-
py{27,34,py,py3}: rfc3987
1613

17-
py26: argparse
14+
-e{toxinidir}[format]
15+
1816
py26: unittest2
1917
py{26,27,py,py3}: mock
2018

0 commit comments

Comments
 (0)