source: create_distribution.py @ 3949

Last change on this file since 3949 was 3937, checked in by ole, 17 years ago

Fine tuned release script.

File size: 3.7 KB
Line 
1"""Create a distribution of ANUGA from latest revision
2
3   This script is assumed to be run in the root directory of anuga
4   from a working sandpit connected to svn
5
6   This script works only on Linux
7"""
8
9from os import sep, system, remove
10from tempfile import mktemp
11from sys import platform
12from anuga.utilities.system_tools import get_user_name, get_host_name
13
14
15if platform == 'win32':
16    msg = 'This script is not written for Windows.'+\
17          'Please run it on a Unix platform'
18    raise Exception, msg
19
20
21# Define main version manually
22major_revision = '1.0'
23
24
25# Refresh sandit and retrieve svn revision number
26# from last line in svn update output
27filename = mktemp() + '.txt'
28
29s = 'svn update > %s' %filename
30print s
31system(s)
32
33fid = open(filename)
34last_line = fid.readlines()[-1]
35remove(filename)
36if not (last_line.startswith('At revision') or\
37        last_line.startswith('Updated to revision')):
38    msg = 'Unexpected output from svn up: %s' %last_line
39    raise Exception, msg   
40
41fields = last_line.split()
42svn_revision = fields[-1][:-1]
43
44revision = '%s_%s' %(major_revision, svn_revision)
45
46print 'Creating ANUGA revision %s' %revision
47
48distro_filename = 'anuga-%s.tgz' %revision
49
50# Create area directory
51release_dir = '~/anuga_release_%s' %revision
52s = 'mkdir %s' %release_dir
53try:
54    system(s)
55except:
56    pass
57
58
59# Export a clean directory tree from the working copy
60distro_dir = mktemp()
61s = 'mkdir %s' %distro_dir
62print s
63system(s)
64
65s = 'svn export anuga_core/source/anuga %s/anuga' %(distro_dir) 
66print s
67system(s)
68
69# Zip it up
70s = 'cd %s;tar cvfz %s *' %(distro_dir, distro_filename)
71print s
72system(s)
73
74# Move distro to release area
75s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
76print s
77system(s)
78
79# Clean up
80s = '/bin/rm -rf %s/anuga' %(distro_dir) 
81print s
82system(s)
83
84
85#-----------------------------
86# Get validation_files as well
87
88s = 'mkdir %s/anuga_validation' %distro_dir
89system(s)
90
91s = 'svn export anuga_validation/okushiri_2005 %s/anuga_validation/okushiri'\
92    %(distro_dir) 
93print s
94system(s)
95
96# Other validations in here!!!
97
98# Zip it up
99s = 'cd %s;tar cvfz anuga_validation-%s.tgz *'\
100    %(distro_dir, revision)
101print s
102system(s)
103
104# Move distro to release area
105s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
106print s
107system(s)
108
109# Clean up
110s = '/bin/rm -rf %s/anuga_validation' %(distro_dir) 
111print s
112system(s)
113
114#-----------------------------
115# Copy anuga_viewer
116s = '/bin/cp ./anuga_core/source/anuga_viewer/distros/anuga_viewer_1.0.tgz %s'\
117    %(distro_dir)
118print s
119system(s)
120
121# Move distro to release area
122s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
123print s
124system(s)
125
126#-----------------------------
127# Hey, why not compile and bundle up the LaTeX documentation as well
128
129s = 'cd anuga_core/documentation/user_manual;'
130s += 'python update_anuga_user_manual.py --no_html'
131print s
132system(s)
133
134s = '/bin/mv anuga_core/documentation/user_manual/anuga_user_manual.pdf %s'\
135    %(release_dir)
136print s
137system(s)
138
139s = '/bin/mv anuga_core/documentation/user_manual/anuga_installation_guide.pdf %s'\
140    %(release_dir)
141print s
142system(s)
143
144
145
146#-----------------------------
147print 'Done'
148print
149print
150print 'The release files are in %s:' %release_dir
151system('ls -la %s' %release_dir)
152
153
154
155#----------------------------
156# Throw away code to drop all files into the RAMP download area
157# This is hardwired for Ole
158
159if get_user_name() == 'ole' and get_host_name() == 'nautilus':
160
161    s = 'rsync -avz %s/*.tgz onielsen@cyclone:/d/cit/1/cit/risk_assessment_methods_project/downloads/ANUGA_install/%s' %(release_dir, 'anuga_%s' %revision)
162    print s
163    system(s)
164   
165    system('scp %s/*.pdf onielsen@cyclone:/d/cit/1/cit/risk_assessment_methods_project/downloads/ANUGA_install' %release_dir)
Note: See TracBrowser for help on using the repository browser.