More robust error handling and fix last commit

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9744 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2007-05-01 21:14:30 +00:00
commit ba168b3403

View file

@ -7,6 +7,11 @@ import sys
import string import string
import os import os
def failed():
print "Failed to complete"
sys.exit(1)
try: try:
version = sys.argv[1] version = sys.argv[1]
dirname = "swig-" + version dirname = "swig-" + version
@ -17,7 +22,7 @@ except:
# Check name matches normal unix conventions # Check name matches normal unix conventions
if string.lower(dirname) != dirname: if string.lower(dirname) != dirname:
print "directory name ("+dirname+") should be in lowercase" print "directory name ("+dirname+") should be in lowercase"
sys.exit(0) sys.exit(2)
# If directory and tarball exist, remove it # If directory and tarball exist, remove it
print "Removing ", dirname print "Removing ", dirname
@ -32,32 +37,33 @@ os.system("rm -f "+dirname+".tar")
# Do a SVN export into the directory name # Do a SVN export into the directory name
print "Grabbing latest SWIG from svn" print "Grabbing latest SWIG from svn"
os.system("svn export -r HEAD https://swig.svn.sourceforge.net/svnroot/swig/trunk "+dirname) os.system("svn export -r HEAD https://swig.svn.sourceforge.net/svnroot/swig/trunk "+dirname) == 0 or failed()
# Remove the debian directory -- it's not official # Remove the debian directory -- it's not official
os.system("rm -Rf "+dirname+"/debian"); os.system("rm -Rf "+dirname+"/debian") == 0 or failed()
# Blow away all .cvsignore files # Blow away all .cvsignore files
print "Blowing away .cvsignore files" print "Blowing away .cvsignore files"
os.system("find "+dirname+" -name .cvsignore -exec rm {} \\;"); os.system("find "+dirname+" -name .cvsignore -exec rm {} \\;") == 0 or failed()
# Go build the system # Go build the system
print "Building system" print "Building system"
os.system("cd "+dirname+"; ./autogen.sh") os.system("cd "+dirname+"; ./autogen.sh") == 0 or failed()
os.system("cd "+dirname+"/Tools/WAD; autoconf") os.system("cd "+dirname+"/Tools/WAD; autoconf") == 0 or failed()
os.system("cd "+dirname+"; make maintainer") os.system("cd "+dirname+"/Source/CParse; bison -y -d parser.y; mv y.tab.c parser.c; mv y.tab.h parser.h") == 0 or failed()
os.system("cd "+dirname+"; make -f Makefile.in libfiles srcdir=./") == 0 or failed()
# Remove autoconf files # Remove autoconf files
os.system("find "+dirname+" -name autom4te.cache -exec rm -rf {} \\;"); os.system("find "+dirname+" -name autom4te.cache -exec rm -rf {} \\;")
# Build documentation # Build documentation
print "Building documentation" print "Building documentation"
os.system("cd "+dirname+"/Doc/Manual; make; rm *.bak") os.system("cd "+dirname+"/Doc/Manual && make && rm *.bak") == 0 or failed()
# Build the tar-ball # Build the tar-ball
os.system("tar -cf "+dirname+".tar "+dirname) os.system("tar -cf "+dirname+".tar "+dirname) == 0 or failed()
os.system("gzip "+dirname+".tar") os.system("gzip "+dirname+".tar") == 0 or failed()