Staging
v0.8.1
https://github.com/python/cpython
Revision 3efafd77498def137f4afbcf2abee9aa2aed460a authored by Ezio Melotti on 02 August 2010, 18:40:55 UTC, committed by Ezio Melotti on 02 August 2010, 18:40:55 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77942 | ezio.melotti | 2010-02-03 07:37:26 +0200 (Wed, 03 Feb 2010) | 1 line

  #7092: Silence more py3k warnings. Patch by Florent Xicluna.
........
  r79023 | ezio.melotti | 2010-03-17 15:52:48 +0200 (Wed, 17 Mar 2010) | 1 line

  #7092: silence some more py3k warnings.
........
1 parent 5ff2745
Raw File
Tip revision: 3efafd77498def137f4afbcf2abee9aa2aed460a authored by Ezio Melotti on 02 August 2010, 18:40:55 UTC
Merged revisions 77942,79023 via svnmerge from
Tip revision: 3efafd7
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