Replace the impenetrable line of perl with python
Mostly because the standard emscripten docker image does not have libjson-perl, but python always comes with json. But also because it was impenetrable.
This commit is contained in:
parent
b1beadacee
commit
3e775938e5
2 changed files with 19 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -164,7 +164,7 @@ fuzzers: $(FUZZER_BINARIES) $(FUZZER_DEBUG_BINARIES)
|
||||||
.PHONY: fuzzers
|
.PHONY: fuzzers
|
||||||
|
|
||||||
$(JS_EXPORTED_FUNCTIONS): $(PUBLIC_HEADERS)
|
$(JS_EXPORTED_FUNCTIONS): $(PUBLIC_HEADERS)
|
||||||
perl -MJSON -ne '$$f{"_$$1"}=1 if /(olm_[^( ]*)\(/; END { @f=sort keys %f; print encode_json \@f }' $^ > $@.tmp
|
./exports.py $^ > $@.tmp
|
||||||
mv $@.tmp $@
|
mv $@.tmp $@
|
||||||
|
|
||||||
all: test js lib debug doc
|
all: test js lib debug doc
|
||||||
|
|
18
exports.py
Executable file
18
exports.py
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
expr = re.compile(r"(olm_[^( ]*)\(")
|
||||||
|
|
||||||
|
exports = set()
|
||||||
|
|
||||||
|
for f in sys.argv[1:]:
|
||||||
|
with open(f) as fp:
|
||||||
|
for line in fp:
|
||||||
|
matches = expr.search(line)
|
||||||
|
if matches is not None:
|
||||||
|
exports.add('_%s' % (matches.group(1),))
|
||||||
|
|
||||||
|
json.dump(sorted(exports), sys.stdout)
|
Loading…
Reference in a new issue