Load the version information from ../Include/patchlevel.h, so there are

fewer changes to make to version numbers after a release.
This commit is contained in:
Fred Drake 2003-09-27 22:07:05 +00:00
parent 43b5e40795
commit c8083cf1cc
6 changed files with 105 additions and 9 deletions

View File

@ -64,9 +64,14 @@ PAPER=letter
INFODIR= info
TOOLSDIR= tools
# This is the *documentation* release, and is used to construct the file
# names of the downloadable tarballs.
RELEASE=2.4a0
# This is the *documentation* release, and is used to construct the
# file names of the downloadable tarballs. It is initialized by the
# getversioninfo script to ensure that the right version number is
# used; the script will also write commontex/patchlevel.tex if that
# doesn't exist or needs to be changed. Documents which depend on the
# version number should use \input{patchlevel} and include
# commontex/patchlevel.tex in their dependencies.
RELEASE=$(shell $(PYTHON) tools/getversioninfo)
PYTHON= python
DVIPS= dvips -N0 -t $(PAPER)

View File

@ -7,6 +7,7 @@ INDEXSTYLES=texinputs/python.ist
COMMONTEX=commontex/copyright.tex \
commontex/license.tex \
commontex/patchlevel.tex \
commontex/boilerplate.tex
MANSTYLES= texinputs/fncychap.sty \

1
Doc/commontex/.cvsignore Normal file
View File

@ -0,0 +1 @@
patchlevel.tex

View File

@ -6,6 +6,4 @@
}
\date{\today} % XXX update before final release!
\release{2.4} % software release, not documentation
\setreleaseinfo{a0} % empty for final release
\setshortversion{2.4} % major.minor only for software
\input{patchlevel} % include Python version information

72
Doc/tools/getversioninfo Executable file
View File

@ -0,0 +1,72 @@
#! /usr/bin/env python
import os
import re
import sys
try:
__file__
except NameError:
__file__ = sys.argv[0]
tools = os.path.dirname(os.path.abspath(__file__))
Doc = os.path.dirname(tools)
src = os.path.dirname(Doc)
patchlevel_h = os.path.join(src, "Include", "patchlevel.h")
# This won't pick out all #defines, but it will pick up the ones we
# care about.
rx = re.compile(r"\s*#define\s+([a-zA-Z][a-zA-Z_0-9]*)\s+([a-zA-Z_0-9]+)")
d = {}
f = open(patchlevel_h)
for line in f:
m = rx.match(line)
if m is not None:
name, value = m.group(1, 2)
d[name] = value
f.close()
release = "%s.%s" % (d["PY_MAJOR_VERSION"], d["PY_MINOR_VERSION"])
micro = int(d["PY_MICRO_VERSION"])
shortversion = release
if micro != 0:
release += "." + str(micro)
level = d["PY_RELEASE_LEVEL"]
suffixes = {
"PY_RELEASE_LEVEL_ALPHA": "a",
"PY_RELEASE_LEVEL_BETA": "b",
"PY_RELEASE_LEVEL_GAMMA": "c",
}
releaseinfo = ""
if level != "PY_RELEASE_LEVEL_FINAL":
releaseinfo = suffixes[level] + str(int(d["PY_RELEASE_SERIAL"]))
def write_file(name, text):
"""Write text to a file if the file doesn't exist or if text
differs from any existing content."""
if os.path.exists(name):
f = open(name, "r")
s = f.read()
f.close()
if s == text:
return
f = open(name, "w")
f.write(text)
f.close()
patchlevel_tex = os.path.join(Doc, "commontex", "patchlevel.tex")
Makefile_version = os.path.join(Doc, "Makefile.version")
write_file(patchlevel_tex,
"%% This file is generated by ../tools/getversioninfo;\n"
"%% do not edit manually.\n"
"\n"
"\\release{%s}\n"
"\\setreleaseinfo{%s}\n"
"\\setshortversion{%s}\n"
% (release, releaseinfo, shortversion))
print release + releaseinfo

View File

@ -26,6 +26,14 @@ import tempfile
import cvsinfo
try:
__file__
except NameError:
__file__ = sys.argv[0]
tools = os.path.dirname(os.path.abspath(__file__))
Doc = os.path.dirname(tools)
patchlevel_tex = os.path.join(Doc, "commontex", "patchlevel.tex")
quiet = 0
rx = re.compile(r":ext:(?:[a-zA-Z0-9]+)@cvs\.([a-zA-Z0-9]+).sourceforge.net:"
@ -102,8 +110,19 @@ def main():
# remove CVS directories
for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'):
map(shutil.rmtree, glob.glob(p))
for f in ('.cvsignore', '*/.cvsignore'):
map(os.unlink, glob.glob(f))
for f in ('.cvsignore', '*/.cvsignore'):
map(os.unlink, glob.glob(f))
# Copy in the version informtation, if we're not just going to
# rip it back out:
if not tools:
if not os.path.exists(patchlevel_tex):
run(os.path.join(here, "getversioninfo"))
dest = os.path.join("Python-Docs-" + release, "commontex",
"patchlevel.tex")
shutil.copyfile(patchlevel_tex, dest)
# Copy in the license file:
LICENSE = os.path.normpath(
os.path.join(mydir, os.pardir, os.pardir, "LICENSE"))
shutil.copyfile(LICENSE, "LICENSE")
@ -111,7 +130,7 @@ def main():
archive = "doctools-" + release
# we don't want the actual documents in this case:
for d in ("api", "dist", "doc", "ext", "inst",
"lib", "mac", "ref", "tut"):
"lib", "mac", "ref", "tut", "commontex"):
shutil.rmtree(os.path.join(pkgdir, d))
else:
archive = "latex-" + release