MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / GetVersion

Function GetVersion

tools/building.py:997–1018  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

995 src.remove(item)
996
997def GetVersion():
998 import SCons.cpp
999 import string
1000
1001 rtdef = os.path.join(Rtt_Root, 'include', 'rtdef.h')
1002
1003 # parse rtdef.h to get RT-Thread version
1004 prepcessor = create_preprocessor_instance()
1005 f = open(rtdef, 'r')
1006 contents = f.read()
1007 f.close()
1008 prepcessor.process_contents(contents)
1009 def_ns = prepcessor.cpp_namespace
1010
1011 version = int([ch for ch in def_ns['RT_VERSION_MAJOR'] if ch in '0123456789.'])
1012 subversion = int([ch for ch in def_ns['RT_VERSION_MINOR'] if ch in '0123456789.'])
1013
1014 if 'RT_VERSION_PATCH' in def_ns:
1015 revision = int([ch for ch in def_ns['RT_VERSION_PATCH'] if ch in '0123456789.'])
1016 return '%d.%d.%d' % (version, subversion, revision)
1017
1018 return '0.%d.%d' % (version, subversion)
1019
1020def GlobSubDir(sub_dir, ext_name):
1021 import os

Callers

nothing calls this directly

Calls 4

openFunction · 0.50
joinMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected