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