/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v24.19.0
tools/getnodeversion.py
21 строка
676 B
Christian Clauss
tools: cleanup getnodeversion.py for readability
23 сен 2019, 22:06
23 сен 2019, 22:06
0692995
Код
Авторство
О чём код?
from __future__ import print_function import os 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 node_version_h = os.path.join(os.path.dirname(__file__), '..', 'src', 'node_version.h') with open(node_version_h) as in_file: print('.'.join(get_major_minor_patch(in_file.read())))