File: systemfuncs2code.py

package info (click to toggle)
openmsx 20.0%2Bdfsg-1.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,544 kB
  • sloc: cpp: 236,922; xml: 49,948; tcl: 15,056; python: 5,385; perl: 281; sh: 77; makefile: 53
file content (32 lines) | stat: -rw-r--r-- 816 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
23
24
25
26
27
28
29
30
31
32
from systemfuncs import systemFunctions
from outpututils import rewriteIfChanged

import sys

def iterSystemFuncsHeader(functionResults):
	yield '// Automatically generated by build system.'
	for makeName in sorted(
		func.getMakeName() for func in systemFunctions
		):
		yield '#define HAVE_%s %d' % (makeName, functionResults[makeName])

def getSystemFuncsInfo():
	return dict.fromkeys(
		(func.getMakeName() for func in systemFunctions),
		False
		)

if __name__ == '__main__':
	if len(sys.argv) == 2:
		rewriteIfChanged(
			sys.argv[1],
			iterSystemFuncsHeader(getSystemFuncsInfo())
			)
	else:
		print('Usage: python3 systemfuncs2code.py CONFIG_HEADER ', file=sys.stderr)
		print(
			'Note: Should only be called directly on systems '
			'where the probe does not work.',
			file=sys.stderr
			)
		sys.exit(2)