From 3e775938e50bffdfcb20241d598fea74ddaaf7e0 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 3 Oct 2018 16:06:15 +0100 Subject: 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. --- Makefile | 2 +- exports.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 exports.py diff --git a/Makefile b/Makefile index 154954c..901e78f 100644 --- a/Makefile +++ b/Makefile @@ -164,7 +164,7 @@ fuzzers: $(FUZZER_BINARIES) $(FUZZER_DEBUG_BINARIES) .PHONY: fuzzers $(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 $@ all: test js lib debug doc diff --git a/exports.py b/exports.py new file mode 100755 index 0000000..b37cbbb --- /dev/null +++ b/exports.py @@ -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) -- cgit v1.2.3