diff options
author | NickNaso <nicoladelgobbo@gmail.com> | 2019-05-23 11:57:31 +0200 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-07-02 11:46:59 +0200 |
commit | cd71aad62bfcb83dfcc7b6267c6cc6e9bf49aa70 (patch) | |
tree | a136366cb033d4618f7ae99bd5ef867b447f92f5 /tools | |
parent | 8a64b70efe9207f4eaad818780ab3088c91899fe (diff) | |
download | android-node-v8-cd71aad62bfcb83dfcc7b6267c6cc6e9bf49aa70.tar.gz android-node-v8-cd71aad62bfcb83dfcc7b6267c6cc6e9bf49aa70.tar.bz2 android-node-v8-cd71aad62bfcb83dfcc7b6267c6cc6e9bf49aa70.zip |
build: expose napi_build_version variable
Expose `napi_build_version` to allow `node-gyp` to make it
available for building native addons.
Fixes: https://github.com/nodejs/node-gyp/issues/1745
Refs: https://github.com/nodejs/abi-stable-node/issues/371
PR-URL: https://github.com/nodejs/node/pull/27835
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/getnapibuildversion.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/getnapibuildversion.py b/tools/getnapibuildversion.py new file mode 100644 index 0000000000..de1de676d3 --- /dev/null +++ b/tools/getnapibuildversion.py @@ -0,0 +1,26 @@ +from __future__ import print_function +import os +import re + + +def get_napi_version(): + napi_version_h = os.path.join( + os.path.dirname(__file__), + '..', + 'src', + 'node_version.h') + + f = open(napi_version_h) + + regex = '^#define NAPI_VERSION' + + for line in f: + if re.match(regex, line): + napi_version = line.split()[2] + return napi_version + + raise Exception('Could not find pattern matching %s' % regex) + + +if __name__ == '__main__': + print(get_napi_version()) |