diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-10-11 18:25:52 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-10-11 18:25:52 (GMT) |
commit | c78462fb94b15d71c0dbfa6f3dfc2fabd29f635f (patch) | |
tree | b91c95ae3b47f21193f141d7e20f3013863b07be /PCbuild | |
parent | ce2f663c48eb41cd3ccb4ddad5d8b5398f5ccb46 (diff) | |
download | cpython-c78462fb94b15d71c0dbfa6f3dfc2fabd29f635f.zip cpython-c78462fb94b15d71c0dbfa6f3dfc2fabd29f635f.tar.gz cpython-c78462fb94b15d71c0dbfa6f3dfc2fabd29f635f.tar.bz2 |
The MS resource compiler simply cannot be convinced to do arithmetic
correctly. So field3.py is a Python program that can. This injects
another manual step into the Python release process for Windows; so
it goes.
Diffstat (limited to 'PCbuild')
-rw-r--r-- | PCbuild/field3.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/PCbuild/field3.py b/PCbuild/field3.py new file mode 100644 index 0000000..47f24ca --- /dev/null +++ b/PCbuild/field3.py @@ -0,0 +1,35 @@ +# An absurd workaround for the lack of arithmetic in MS's resource compiler. +# After building Python, run this, then paste the output into the appropriate +# part of PC\python_nt.rc. +# Example output: +# +# * For 2.3a0, +# * PY_MICRO_VERSION = 0 +# * PY_RELEASE_LEVEL = 'alpha' = 0xA +# * PY_RELEASE_SERIAL = 1 +# * +# * and 0*1000 + 10*10 + 1 = 101. +# */ +# #define FIELD3 101 + +import sys + +major, minor, micro, level, serial = sys.version_info +levelnum = {'alpha': 0xA, + 'beta': 0xB, + 'candidate': 0xC, + 'final': 0xF, + }[level] +string = sys.version.split()[0] # like '2.3a0' + +print " * For %s," % string +print " * PY_MICRO_VERSION = %d" % micro +print " * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)) +print " * PY_RELEASE_SERIAL = %d" % serial +print " *" + +field3 = micro * 1000 + levelnum * 10 + serial + +print " * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3) +print " */" +print "#define FIELD3", field3 |