source: create_distribution.py @ 4122

Last change on this file since 4122 was 4122, checked in by ole, 18 years ago

Version number in user guides

File size: 4.6 KB
RevLine 
[3892]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
[3937]12from anuga.utilities.system_tools import get_user_name, get_host_name
[3892]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
[4122]22major_revision = '1.0beta'
[3892]23
24
[3922]25# Refresh sandit and retrieve svn revision number
26# from last line in svn update output
[3892]27filename = mktemp() + '.txt'
28
29s = 'svn update > %s' %filename
30print s
31system(s)
32
33fid = open(filename)
[3922]34last_line = fid.readlines()[-1]
[3892]35remove(filename)
[3934]36if not (last_line.startswith('At revision') or\
37        last_line.startswith('Updated to revision')):
[3922]38    msg = 'Unexpected output from svn up: %s' %last_line
[3892]39    raise Exception, msg   
40
[3934]41fields = last_line.split()
42svn_revision = fields[-1][:-1]
[3892]43
[3922]44revision = '%s_%s' %(major_revision, svn_revision)
[3892]45
[3934]46print 'Creating ANUGA revision %s' %revision
47
[3892]48distro_filename = 'anuga-%s.tgz' %revision
49
[3902]50# Create area directory
51release_dir = '~/anuga_release_%s' %revision
52s = 'mkdir %s' %release_dir
53try:
54    system(s)
55except:
56    pass
57
58
[3892]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
[3902]74# Move distro to release area
75s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
76print s
77system(s)
78
[3892]79# Clean up
80s = '/bin/rm -rf %s/anuga' %(distro_dir) 
81print s
82system(s)
83
[3902]84
85#-----------------------------
[3892]86# Get validation_files as well
[3902]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) 
[3892]93print s
94system(s)
95
[4012]96s = 'svn export anuga_validation/solitary_waves %s/anuga_validation/solitary_waves'\
97    %(distro_dir) 
98print s
99system(s)
100
[3892]101# Other validations in here!!!
102
103# Zip it up
104s = 'cd %s;tar cvfz anuga_validation-%s.tgz *'\
105    %(distro_dir, revision)
106print s
107system(s)
108
[3902]109# Move distro to release area
110s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
111print s
112system(s)
113
[3892]114# Clean up
[3902]115s = '/bin/rm -rf %s/anuga_validation' %(distro_dir) 
[3892]116print s
117system(s)
118
[3987]119
[3902]120#-----------------------------
[3987]121# Get demos from user manual
122
123#s = 'mkdir %s/anuga_demos' %distro_dir
124#system(s)
125
126s = 'svn export anuga_core/documentation/user_manual/demos %s/anuga_demos'\
127    %(distro_dir) 
128print s
129system(s)
130
131# Zip it up
132s = 'cd %s;tar cvfz anuga_demos-%s.tgz *'\
133    %(distro_dir, revision)
134print s
135system(s)
136
137# Move distro to release area
138s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
139print s
140system(s)
141
142# Clean up
143s = '/bin/rm -rf %s/anuga_demos' %(distro_dir) 
144print s
145system(s)
146
147
148
149#-----------------------------
[3892]150# Copy anuga_viewer
151s = '/bin/cp ./anuga_core/source/anuga_viewer/distros/anuga_viewer_1.0.tgz %s'\
152    %(distro_dir)
153print s
154system(s)
155
[3902]156# Move distro to release area
[3892]157s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
158print s
159system(s)
[3902]160
[3922]161#-----------------------------
162# Hey, why not compile and bundle up the LaTeX documentation as well
[3902]163
[3922]164s = 'cd anuga_core/documentation/user_manual;'
165s += 'python update_anuga_user_manual.py --no_html'
166print s
167system(s)
168
[4122]169release_name = 'anuga_user_manual-%s.pdf' %revision
170s = '/bin/mv anuga_core/documentation/user_manual/anuga_user_manual.pdf %s/%s'\
171    %(release_dir, release_name)
[3922]172print s
173system(s)
174
[4122]175
176release_name = 'anuga_installation_guide-%s.pdf' %revision
177s = '/bin/mv anuga_core/documentation/user_manual/anuga_installation_guide.pdf %s/%s' %(release_dir, release_name)   
178   
[3922]179print s
180system(s)
181
182
183
[3902]184#-----------------------------
[3892]185print 'Done'
186print
187print
188print 'The release files are in %s:' %release_dir
189system('ls -la %s' %release_dir)
[3934]190
191
192
193#----------------------------
194# Throw away code to drop all files into the RAMP download area
195# This is hardwired for Ole
196
[3937]197if get_user_name() == 'ole' and get_host_name() == 'nautilus':
[3934]198
[3990]199    # Copy to RAMP
200    s = 'rsync -avz %s/* onielsen@cyclone:/d/cit/1/cit/risk_assessment_methods_project/downloads/ANUGA_install/%s' %(release_dir, 'anuga_%s' %revision)
[3937]201    print s
202    system(s)
203   
[3990]204    #system('scp %s/*.pdf onielsen@cyclone:/d/cit/1/cit/risk_assessment_methods_project/downloads/ANUGA_install' %release_dir)#
205
206
207   
208    # Copy to the ANU
209
[3991]210    s = 'rsync -avz %s/* ole@datamining.anu.edu.au:public_html/software/anuga/%s' %(release_dir, 'anuga_%s' %revision)
[3990]211    print s
212    system(s)
213   
214   
Note: See TracBrowser for help on using the repository browser.