Load meta-schemas via pkgutil rather than searching the filesystem.
Hopefully this makes things like cx_Freeze work, but they appear to all be special snowflakes and this doesn't appear easy to test. Credit to @pjdelport for helping clear away some of the smoke. Closes #161, #162
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import itertools
|
||||
import json
|
||||
import pkgutil
|
||||
import re
|
||||
import os
|
||||
|
||||
from jsonschema.compat import str_types, MutableMapping, urlsplit
|
||||
|
||||
@@ -54,11 +54,8 @@ def load_schema(name):
|
||||
|
||||
"""
|
||||
|
||||
schema_dir = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)), "schemas",
|
||||
)
|
||||
with open(os.path.join(schema_dir, name + ".json")) as schema_file:
|
||||
return json.load(schema_file)
|
||||
data = pkgutil.get_data(__package__, "schemas/{0}.json".format(name))
|
||||
return json.loads(data.decode("utf-8"))
|
||||
|
||||
|
||||
def indent(string, times=1):
|
||||
|
Reference in New Issue
Block a user