Fixed loading problem for schema json

This commit is contained in:
Colin Dunklau
2013-05-12 21:44:04 -05:00
parent 7cea7cc3f5
commit de9d6993b2
2 changed files with 7 additions and 1 deletions

View File

@@ -43,7 +43,10 @@ def load_schema(name):
Load a schema from ./schemas/``name``.json and return it. Load a schema from ./schemas/``name``.json and return it.
""" """
schemadir = os.path.join(os.path.dirname(__file__), 'schemas') schemadir = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'schemas'
)
schemapath = os.path.join(schemadir, '%s.json' % (name,)) schemapath = os.path.join(schemadir, '%s.json' % (name,))
with open(schemapath) as f: with open(schemapath) as f:
return json.load(f) return json.load(f)

View File

@@ -1,3 +1,5 @@
import os
import glob
from distutils.core import setup from distutils.core import setup
from jsonschema import __version__ from jsonschema import __version__
@@ -29,6 +31,7 @@ setup(
name="jsonschema", name="jsonschema",
version=__version__, version=__version__,
packages=["jsonschema"], packages=["jsonschema"],
package_data={'jsonschema': ['schemas/*.json']},
author="Julian Berman", author="Julian Berman",
author_email="Julian@GrayVines.com", author_email="Julian@GrayVines.com",
classifiers=classifiers, classifiers=classifiers,