diff options
author | NickNaso <nicoladelgobbo@gmail.com> | 2019-05-23 11:57:31 +0200 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2019-07-01 22:07:42 -0700 |
commit | 9868126546b93ed992cff094e1884af3a88460a3 (patch) | |
tree | ae495efbc2fecb962a8a5b1c45bb8856c1ba8997 /tools | |
parent | e008ca8b93af0eb5e360ee1244680c914a795344 (diff) | |
download | android-node-v8-9868126546b93ed992cff094e1884af3a88460a3.tar.gz android-node-v8-9868126546b93ed992cff094e1884af3a88460a3.tar.bz2 android-node-v8-9868126546b93ed992cff094e1884af3a88460a3.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()) |