PageRenderTime 40ms CodeModel.GetById 32ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Tools/mkdist.py

#
Python | 67 lines | 36 code | 20 blank | 11 comment | 10 complexity | a4dd44ec930162df9889e63651424322 MD5 | raw file
 1#!/usr/bin/env python
 2
 3# This script builds a swig-x.y.z distribution.
 4# Usage : mkdist.py version, where version should be x.y.z
 5
 6import sys
 7import string
 8import os
 9
10def failed():
11  print "mkdist.py failed to complete"
12  sys.exit(2)
13
14
15try:
16   version = sys.argv[1]
17   dirname = "swig-" + version
18except:
19   print "Usage: mkdist.py version, where version should be x.y.z"
20   sys.exit(1)
21
22# Check name matches normal unix conventions
23if string.lower(dirname) != dirname:
24  print "directory name ("+dirname+") should be in lowercase"
25  sys.exit(3)
26
27# If directory and tarball exist, remove it
28print "Removing ", dirname
29os.system("rm -rf "+dirname)
30
31print "Removing "+dirname+".tar if exists"
32os.system("rm -f "+dirname+".tar.gz")
33
34print "Removing "+dirname+".tar.gz if exists"
35os.system("rm -f "+dirname+".tar")
36
37# Do a SVN export into the directory name
38
39print "Grabbing latest SWIG from svn"
40os.system("svn export -r HEAD https://swig.svn.sourceforge.net/svnroot/swig/trunk "+dirname) == 0 or failed()
41
42# Remove the debian directory -- it's not official
43
44os.system("rm -Rf "+dirname+"/debian") == 0 or failed()
45
46# Go build the system
47
48print "Building system"
49os.system("cd "+dirname+" && ./autogen.sh") == 0 or failed()
50os.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()
51os.system("cd "+dirname+" && make -f Makefile.in libfiles srcdir=./") == 0 or failed()
52
53# Remove autoconf files
54os.system("find "+dirname+" -name autom4te.cache -exec rm -rf {} \\;")
55
56# Build documentation
57print "Building html documentation"
58os.system("cd "+dirname+"/Doc/Manual && make all clean-baks") == 0 or failed()
59print "Building man pages"
60os.system("cd "+dirname+"/CCache && yodl2man -o ccache-swig.1 ccache.yo") == 0 or failed()
61
62# Build the tar-ball
63os.system("tar -cf "+dirname+".tar "+dirname) == 0 or failed()
64os.system("gzip "+dirname+".tar") == 0 or failed()
65
66print "Finished building "+dirname+".tar.gz"
67