Skip to content

Commit

Permalink
Fix issues with missing rjsmin python package (#2223)
Browse files Browse the repository at this point in the history
Add rjsmin.py directly to source (suggested by author https://github.com/ndparker/rjsmin)
Catch missing `jsonschema` and generate warning, but allow compilation to continue

IFS: Apply the same changes, plus use `strerror` instead of `strerror_r` as it's more standard.
  • Loading branch information
slaff authored Feb 22, 2021
2 parents 295a5f3 + 3fcb3ca commit 49e2248
Show file tree
Hide file tree
Showing 6 changed files with 555 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Sming/Components/IFS
8 changes: 1 addition & 7 deletions Sming/Components/Storage/Tools/hwconfig/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
#

import os, partition, storage
from rjsmin import jsmin
from common import *
from builtins import classmethod

try:
from rjsmin import jsmin
except ImportError as err:
sys.stderr.write("\n** %s: please run `make python-requirements` **\n\n" % str(err))
sys.exit(1)


def findConfig(name):
dirs = os.environ['HWCONFIG_DIRS'].split(' ')
for d in dirs:
Expand Down
21 changes: 10 additions & 11 deletions Sming/Components/Storage/Tools/hwconfig/hwconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ def main():
# Validate resulting hardware configuration against schema
try:
from jsonschema import Draft7Validator
except ImportError:
critical("hwconfig: `jsonschema` is not installed. Please run `make python-requirements`")
sys.exit(1)
inst = json.loads(config.to_json())
schema = json.load(open(args.expr))
v = Draft7Validator(schema)
errors = sorted(v.iter_errors(inst), key=lambda e: e.path)
if errors != []:
for e in errors:
critical("%s @ %s" % (e.message, e.path))
sys.exit(3)
inst = json.loads(config.to_json())
schema = json.load(open(args.expr))
v = Draft7Validator(schema)
errors = sorted(v.iter_errors(inst), key=lambda e: e.path)
if errors != []:
for e in errors:
critical("%s @ %s" % (e.message, e.path))
sys.exit(3)
except ImportError as err:
critical("\n** WARNING! %s: Cannot validate '%s', please run `make python-requirements **\n\n" % (str(err), args.input))
elif args.command == 'flashcheck':
# Expect list of chunks, such as "0x100000=/out/Esp8266/debug/firmware/spiff_rom.bin 0x200000=custom.bin"
list = args.expr.split()
Expand Down
Loading

0 comments on commit 49e2248

Please sign in to comment.