File: version2code.py

package info (click to toggle)
openmsx 21.0%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: forky
  • size: 28,132 kB
  • sloc: cpp: 244,928; xml: 54,344; tcl: 15,603; python: 5,335; perl: 281; sh: 78; makefile: 57
file content (22 lines) | stat: -rw-r--r-- 766 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Generates version include file.

from outpututils import rewriteIfChanged
from version import extractRevisionString, packageVersion, releaseFlag, getCopyright

import sys

def iterVersionInclude():
	revision = extractRevisionString()

	yield '// Automatically generated by build process.'
	yield 'const bool Version::RELEASE = %s;' % str(releaseFlag).lower()
	yield 'const char* const Version::VERSION = "%s";' % packageVersion
	yield 'const char* const Version::REVISION = "%s";' % revision
	yield 'const char* const Version::COPYRIGHT = "%s";' % getCopyright()

if __name__ == '__main__':
	if len(sys.argv) == 2:
		rewriteIfChanged(sys.argv[1], iterVersionInclude())
	else:
		print('Usage: python3 version2code.py VERSION_HEADER', file=sys.stderr)
		sys.exit(2)