diff --git a/examples/commodity-v0.1.json b/examples/commodity-v0.1.json index 3ef668c..715b243 100644 --- a/examples/commodity-v0.1.json +++ b/examples/commodity-v0.1.json @@ -14,7 +14,7 @@ "supplyLevel": "Low", "sellPrice": 1138, "demand": 42, - "demandLevel": "Med" + "demandLevel": "Med", "timestamp": "2014-11-17T12:34:56+00:00" } } \ No newline at end of file diff --git a/examples/commodity-v2.0-draft.json b/examples/commodity-v2.0-draft.json index 82a4e4b..98538a9 100644 --- a/examples/commodity-v2.0-draft.json +++ b/examples/commodity-v2.0-draft.json @@ -8,7 +8,7 @@ "message": { "systemName": "Eranin", "stationName": "Azeban Orbital", - "timestamp": "2014-11-17T12:34:56+00:00" + "timestamp": "2014-11-17T12:34:56+00:00", "commodities": [ { "name": "Gold", diff --git a/setup.py b/setup.py index 73815a1..f7d9830 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,14 @@ from setuptools import setup, find_packages import re +import glob VERSIONFILE = "src/eddn/_version.py" -verstr = "unknown" +verstr = "unknown" try: verstrline = open(VERSIONFILE, "rt").read() - VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" - mo = re.search(VSRE, verstrline, re.M) + VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" + mo = re.search(VSRE, verstrline, re.M) if mo: verstr = mo.group(1) except EnvironmentError: @@ -24,6 +25,7 @@ setup( url='https://github.com/jamesremuscat/eddn', packages=find_packages('src', exclude=["*.tests"]), package_dir = {'':'src'}, + data_files=[('eddn/schemas', glob.glob("schemas/*.json"))], long_description="""\ The Elite: Dangerous Data Network allows E:D players to share data. Not affiliated with Frontier Developments. """, diff --git a/src/eddn/Gateway.py b/src/eddn/Gateway.py index 39f1563..b865e2f 100644 --- a/src/eddn/Gateway.py +++ b/src/eddn/Gateway.py @@ -10,7 +10,10 @@ import urlparse import zlib import zmq.green as zmq from datetime import datetime -from eddn.conf.Settings import Settings, loadConfig + +import os + +from eddn._Conf.Settings import Settings, loadConfig from eddn.Validator import Validator, ValidationSeverity from gevent import monkey @@ -39,7 +42,8 @@ def configure(): sender.bind(binding) for schemaRef, schemaFile in Settings.GATEWAY_JSON_SCHEMAS.iteritems(): - validator.addSchemaResource(schemaRef, schemaFile) + #filename = resource_filename(Requirement.parse("eddn"), schemaFile) + validator.addSchemaResource(schemaRef, os.path.dirname(__file__) + '/' + schemaFile) def push_message(string_message):