Staging
v0.5.1
https://github.com/python/cpython
Revision 800a354fa946d777b8df92e5b0bd07e92f6f9a3b authored by Georg Brandl on 02 August 2010, 17:40:28 UTC, committed by Georg Brandl on 02 August 2010, 17:40:28 UTC
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint

................
  r83533 | georg.brandl | 2010-08-02 19:34:58 +0200 (Mo, 02 Aug 2010) | 9 lines

  Merged revisions 83531 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r83531 | georg.brandl | 2010-08-02 19:24:49 +0200 (Mo, 02 Aug 2010) | 1 line

    #7372: fix regression in pstats: a previous fix to handle cProfile data in add_callers broke handling of profile data.
  ........
................
1 parent cd1f44d
Raw File
Tip revision: 800a354fa946d777b8df92e5b0bd07e92f6f9a3b authored by Georg Brandl on 02 August 2010, 17:40:28 UTC
Merged revisions 83533 via svnmerge from
Tip revision: 800a354
field3.py
# 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)
back to top