Commit 9330eee2 authored by Sebastian Krause's avatar Sebastian Krause 🎨

Added code to stop overwriting the same SEMVER.h file over and over again and...

Added code to stop overwriting the same SEMVER.h file over and over again and triggering a recompile.
parent a585c66a
......@@ -70,6 +70,11 @@ if __name__ == '__main__':
BUILD_TAG, UsesBuildTag = GetBuildTag()
Hash = GetBuildHash()
semverFileDirectory = path
print(semverFileDirectory)
semverFilePath = os.path.join(semverFileDirectory, 'SEMVER.h')
Version = {
**Semver,
'METATAG': BUILD_TAG,
......@@ -85,14 +90,24 @@ if __name__ == '__main__':
if UsesBuildTag:
SemverString = '{Major}.{Minor}.{Patch}-{METATAG}+{BUILDMETA}'.format(**Version)
else:
SemverString = '{Major}.{Minor}.{Patch}+{BUILDMETA}'.format(**Version)
semverFileDirectory = path
print(semverFileDirectory)
semverFilePath = os.path.join(semverFileDirectory, 'SEMVER.h')
SemverString = '{Major}.{Minor}.{Patch}+{BUILDMETA}'.format(**Version)
if os.path.exists(semverFilePath):
f = open(semverFilePath, 'r')
firstLine = f.readline()
if (SemverString + " " + Hash) in firstLine:
print('No Semver Update required.')
exit(0)
f.close()
if not os.path.exists(semverFileDirectory):
os.makedirs(semverFileDirectory)
print(Version)
f = open(semverFilePath, 'w')
f.write('// ' + SemverString + " " + Hash)
f.write('\n')
for key,value in Version.items():
if type(value) == str:
f.write('#define {Prefix}{key} "{value}"'.format(**{'key':key, 'value':value}, Prefix=Config['Prefix']))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment