PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Tools/mkdist.py

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