updating hooks
fix hex gen from relative invocation path
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
################################################################################################################################
|
||||
|
||||
import binascii
|
||||
import pathlib
|
||||
import re
|
||||
import zlib
|
||||
|
||||
@@ -14,6 +15,7 @@ suffixes = ('simple', 'multi')
|
||||
|
||||
linecharlimit = 80
|
||||
linestrp = re.compile(r'^\s*(?P<hex>[A-Fa-f0-9N]+)?(?:\s*//.*)?$')
|
||||
thisdir = pathlib.Path(__file__).absolute().parent
|
||||
|
||||
|
||||
def parse(text):
|
||||
@@ -44,10 +46,10 @@ for p in prefixes:
|
||||
for s in suffixes:
|
||||
fnamebase = '{0}.{1}'.format(p, s)
|
||||
fname = '{0}.txt'.format(fnamebase)
|
||||
with open(fname, 'r') as fh:
|
||||
with open(thisdir.joinpath(fname), 'r') as fh:
|
||||
raw = fh.read().strip()
|
||||
hexstr, bytelen = parse(raw)
|
||||
with open('{0}.hex'.format(fnamebase), 'w') as fh:
|
||||
with open(thisdir.joinpath('{0}.hex'.format(fnamebase)), 'w') as fh:
|
||||
fh.write(hexstr)
|
||||
fh.write('\n')
|
||||
b = binascii.unhexlify(hexstr.replace('\n', '').strip().encode('utf-8'))
|
||||
|
||||
Reference in New Issue
Block a user