1899
|
1 #!/usr/bin/env python
|
|
2
|
|
3 # This script builds the SWIG source tarball, creates the Windows executable and the Windows zip package
|
|
4 # and uploads them both to SF ready for release. Also uploaded are the release notes.
|
|
5 import sys
|
|
6 import string
|
|
7 import os
|
|
8
|
|
9 def failed(message):
|
|
10 if message == "":
|
|
11 print "mkrelease.py failed to complete"
|
|
12 else:
|
|
13 print message
|
|
14 sys.exit(2)
|
|
15
|
|
16 try:
|
|
17 version = sys.argv[1]
|
|
18 username = sys.argv[2]
|
|
19 except:
|
|
20 print "Usage: python mkrelease.py version username"
|
|
21 print "where version should be x.y.z and username is your SF username"
|
|
22 sys.exit(1)
|
|
23
|
|
24 print "Looking for rsync"
|
|
25 os.system("which rsync") and failed("rsync not installed/found. Please install.")
|
|
26
|
|
27 print "Making source tarball"
|
|
28 os.system("python ./mkdist.py " + version) and failed("")
|
|
29
|
|
30 print "Build Windows package"
|
|
31 os.system("./mkwindows.sh " + version) and failed("")
|
|
32
|
|
33 print "Uploading to SourceForge"
|
|
34
|
|
35 swig_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swig/swig-" + version + "/"
|
|
36 swigwin_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swigwin/swigwin-" + version + "/"
|
|
37
|
|
38 # If a file with 'readme' in the name exists in the same folder as the zip/tarball, it gets automatically displayed as the release notes by SF
|
|
39 full_readme_file = "readme-" + version + ".txt"
|
|
40 os.system("rm -f " + full_readme_file)
|
|
41 os.system("cat swig-" + version + "/README " + "swig-" + version + "/CHANGES.current " + "swig-" + version + "/RELEASENOTES " + "> " + full_readme_file)
|
|
42
|
|
43 os.system("rsync --archive --verbose -P --times -e ssh " + "swig-" + version + ".tar.gz " + full_readme_file + " " + swig_dir_sf) and failed("")
|
|
44 os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version + ".zip " + full_readme_file + " " + swigwin_dir_sf) and failed("")
|
|
45
|
|
46 print "Finished"
|
|
47
|
|
48 print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file. Also remember to do a 'git push'."
|