ยปCore Development>Code coverage>PCbuild/field3.py

Python code coverage for PCbuild/field3.py

#countcontent
1n/a# An absurd workaround for the lack of arithmetic in MS's resource compiler.
2n/a# After building Python, run this, then paste the output into the appropriate
3n/a# part of PC\python_nt.rc.
4n/a# Example output:
5n/a#
6n/a# * For 2.3a0,
7n/a# * PY_MICRO_VERSION = 0
8n/a# * PY_RELEASE_LEVEL = 'alpha' = 0xA
9n/a# * PY_RELEASE_SERIAL = 1
10n/a# *
11n/a# * and 0*1000 + 10*10 + 1 = 101.
12n/a# */
13n/a# #define FIELD3 101
14n/a
15n/aimport sys
16n/a
17n/amajor, minor, micro, level, serial = sys.version_info
18n/alevelnum = {'alpha': 0xA,
19n/a 'beta': 0xB,
20n/a 'candidate': 0xC,
21n/a 'final': 0xF,
22n/a }[level]
23n/astring = sys.version.split()[0] # like '2.3a0'
24n/a
25n/aprint(" * For %s," % string)
26n/aprint(" * PY_MICRO_VERSION = %d" % micro)
27n/aprint(" * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)))
28n/aprint(" * PY_RELEASE_SERIAL = %d" % serial)
29n/aprint(" *")
30n/a
31n/afield3 = micro * 1000 + levelnum * 10 + serial
32n/a
33n/aprint(" * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3))
34n/aprint(" */")
35n/aprint("#define FIELD3", field3)