[Python-Dev] first pass at a release checker

Anthony Baxter anthony at interlink.com.au
Wed Oct 1 09:52:50 EDT 2003

Here's the first hack at a quick script for checking a release
tarball for sanity. Please suggest additional checks to make.

At the moment it checks:
  tarball name
  tarball unpacks to a correctly named directory
  no CVS directories in the tarball
  no Release date: XXX in Misc/NEWS
  "configure ; make ; make test" works

Additional checks I plan to add at some point:
  check the version number in Include/patchlevel.h
  check the version number and build number in the windows-specific area

Where should something like this (cleaned up a bit) be checked in?


def Error(message):
    import sys
    print "ERROR:", message

def searchFile(filename, searchPattern, badPattern):
    import re
    searchRe = re.compile(searchPattern)
    badPatternRe = re.compile(badPattern)
    for line in open(filename):
        if searchRe.match(line):
            if badPatternRe.search(line):
                Error("found %s in %s"%(badPattern, filename))

def main(tarball):
    import os
    # make tarball path absolute
    if tarball[0] != "/":
        tarball = os.path.join(os.getcwd(), tarball)
    if tarball[-4:] != ".tgz":
        Error("tarball should end in .tgz")
    # Check tarball is gzipped, maybe check compression level?
    reldir = "checkrel-%d"%(os.getpid())
    print "extracting in %s"%reldir
    print "tarball is %s"%(tarball)
    os.system("tar xzf %s"%(tarball))
    relname = os.path.basename(tarball)[:-4]
    entries = os.listdir(".")
    if len(entries) != 1 or entries[0] != relname:
        Error("tarball should have only created %s"%relname)
    for dirpath, dirnames, filenames in os.walk('.'):
        if "CVS" in dirnames:
            Error("%s contains a CVS directory!"%dirpath)
            # additional checks go here.
    searchFile("Misc/NEWS", "^\*Release date:", "XXX")
    os.system("make testall")

import sys

More information about the Python-Dev mailing list