summaryrefslogtreecommitdiffstats
path: root/PCbuild9/field3.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-17 08:15:27 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-17 08:15:27 (GMT)
commitad14d11a5ed34ed8b82636e876246de181c8de3d (patch)
treebe355d6e8cdfe73d155890ccadcf519da7d6476c /PCbuild9/field3.py
parent1c8e5bc3b793597d2326d705119fb425d0ecf94d (diff)
downloadcpython-ad14d11a5ed34ed8b82636e876246de181c8de3d.zip
cpython-ad14d11a5ed34ed8b82636e876246de181c8de3d.tar.gz
cpython-ad14d11a5ed34ed8b82636e876246de181c8de3d.tar.bz2
Initial import of new PCbuild9 for VS 2008. It partly based on PCbuild and partly hand crafted with some idea from PCbuild8. I've recreated all the extension module projects.
The new directory needs some more love and care but it works. I'm not able to test the AMD64 build. The new tree is heavily using the *.vcprops property sheets. Please set any global settings in the property sheets.
Diffstat (limited to 'PCbuild9/field3.py')
-rw-r--r--PCbuild9/field3.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/PCbuild9/field3.py b/PCbuild9/field3.py
new file mode 100644
index 0000000..edcbe36
--- /dev/null
+++ b/PCbuild9/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)