annotate PCbuild/field3.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents a6319ab49e0a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43972
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
1 # An absurd workaround for the lack of arithmetic in MS's resource compiler.
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
2 # After building Python, run this, then paste the output into the appropriate
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
3 # part of PC\python_nt.rc.
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
4 # Example output:
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
5 #
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
6 # * For 2.3a0,
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
7 # * PY_MICRO_VERSION = 0
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
8 # * PY_RELEASE_LEVEL = 'alpha' = 0xA
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
9 # * PY_RELEASE_SERIAL = 1
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
10 # *
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
11 # * and 0*1000 + 10*10 + 1 = 101.
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
12 # */
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
13 # #define FIELD3 101
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
14
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
15 import sys
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
16
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
17 major, minor, micro, level, serial = sys.version_info
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
18 levelnum = {'alpha': 0xA,
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
19 'beta': 0xB,
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
20 'candidate': 0xC,
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
21 'final': 0xF,
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
22 }[level]
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
23 string = sys.version.split()[0] # like '2.3a0'
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
24
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
25 print(" * For %s," % string)
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
26 print(" * PY_MICRO_VERSION = %d" % micro)
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
27 print(" * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)))
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
28 print(" * PY_RELEASE_SERIAL = %d" % serial)
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
29 print(" *")
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
30
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
31 field3 = micro * 1000 + levelnum * 10 + serial
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
32
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
33 print(" * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3))
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
34 print(" */")
a8dd8874ff2d Backport of the PCbuild9 directory from the py3k branch.
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
35 print("#define FIELD3", field3)