summaryrefslogtreecommitdiffstats
path: root/PCbuild8/field3.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2006-05-27 15:41:31 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2006-05-27 15:41:31 (GMT)
commit2b38e40a5a9ae50e13456fd2c22cd56e3ee372f2 (patch)
treed242bd8508bac157df9fa77ca5207d7d5f13527a /PCbuild8/field3.py
parent0b7ef46950e383aaac7eeed1dff2c622d144fffe (diff)
downloadcpython-2b38e40a5a9ae50e13456fd2c22cd56e3ee372f2.zip
cpython-2b38e40a5a9ae50e13456fd2c22cd56e3ee372f2.tar.gz
cpython-2b38e40a5a9ae50e13456fd2c22cd56e3ee372f2.tar.bz2
Add a PCBuild8 build directory for building with Visual Studio .NET 2005. Contains a special project to perform profile guided optimizations on the pythoncore.dll, by instrumenting and running pybench.py
Diffstat (limited to 'PCbuild8/field3.py')
-rw-r--r--PCbuild8/field3.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/PCbuild8/field3.py b/PCbuild8/field3.py
new file mode 100644
index 0000000..8ed94e9
--- /dev/null
+++ b/PCbuild8/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