Skip to content
Browse files

tools: cleanup for readability

PR-URL: #29648
Reviewed-By: Anna Henningsen <>
Reviewed-By: David Carlier <>
Reviewed-By: Michaël Zasso <>
Reviewed-By: Ben Noordhuis <>
Reviewed-By: Richard Lau <>
Reviewed-By: Ruben Bridgewater <>
  • Loading branch information...
cclauss authored and sam-github committed Sep 21, 2019
1 parent cbd3a1c commit 06929956f9c438d29ca127d8be147e7969bfae35
Showing with 15 additions and 15 deletions.
  1. +15 −15 tools/
@@ -1,21 +1,21 @@
from __future__ import print_function
import os
import re

node_version_h = os.path.join(

f = open(node_version_h)
def get_major_minor_patch(text):
for line in text.splitlines():
if line.startswith('#define NODE_MAJOR_VERSION'):
major = line.split()[2]
elif line.startswith('#define NODE_MINOR_VERSION'):
minor = line.split()[2]
elif line.startswith('#define NODE_PATCH_VERSION'):
patch = line.split()[2]
return major, minor, patch

for line in f:
if re.match('^#define NODE_MAJOR_VERSION', line):
major = line.split()[2]
if re.match('^#define NODE_MINOR_VERSION', line):
minor = line.split()[2]
if re.match('^#define NODE_PATCH_VERSION', line):
patch = line.split()[2]

print('%(major)s.%(minor)s.%(patch)s'% locals())
node_version_h = os.path.join(os.path.dirname(__file__),
with open(node_version_h) as in_file:

0 comments on commit 0692995

Please sign in to comment.
You can’t perform that action at this time.