• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1from __future__ import print_function
2import os
3
4
5def get_major_minor_patch(text):
6  for line in text.splitlines():
7    if line.startswith('#define NODE_MAJOR_VERSION'):
8      major = line.split()[2]
9    elif line.startswith('#define NODE_MINOR_VERSION'):
10      minor = line.split()[2]
11    elif line.startswith('#define NODE_PATCH_VERSION'):
12      patch = line.split()[2]
13  return major, minor, patch
14
15
16node_version_h = os.path.join(os.path.dirname(__file__),
17                              '..',
18                              'src',
19                              'node_version.h')
20with open(node_version_h) as in_file:
21  print('.'.join(get_major_minor_patch(in_file.read())))
22