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 itertools
|
||||||
import json
|
import json
|
||||||
|
import pkgutil
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
|
|
||||||
from jsonschema.compat import str_types, MutableMapping, urlsplit
|
from jsonschema.compat import str_types, MutableMapping, urlsplit
|
||||||
|
|
||||||
@@ -54,11 +54,8 @@ def load_schema(name):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
schema_dir = os.path.join(
|
data = pkgutil.get_data(__package__, "schemas/{0}.json".format(name))
|
||||||
os.path.dirname(os.path.abspath(__file__)), "schemas",
|
return json.loads(data.decode("utf-8"))
|
||||||
)
|
|
||||||
with open(os.path.join(schema_dir, name + ".json")) as schema_file:
|
|
||||||
return json.load(schema_file)
|
|
||||||
|
|
||||||
|
|
||||||
def indent(string, times=1):
|
def indent(string, times=1):
|
||||||
|
|||||||
Reference in New Issue
Block a user