source: create_distribution.py @ 3900

Last change on this file since 3900 was 3892, checked in by ole, 19 years ago

Script to create distributions

File size: 2.1 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
12
13
14if platform == 'win32':
15    msg = 'This script is not written for Windows.'+\
16          'Please run it on a Unix platform'
17    raise Exception, msg
18
19
20# Define main version manually
21major_revision = '1.0'
22
23
24# Refresh sandit and retrieve minor revision number
25filename = mktemp() + '.txt'
26
27s = 'svn update > %s' %filename
28print s
29system(s)
30
31fid = open(filename)
32line = fid.read()
33remove(filename)
34
35if not line.startswith('At revision'):
36    msg = 'Unexpected output from svn up: %s' %line
37    raise Exception, msg   
38
39minor_revision = line[12:-2]
40
41revision = '%s_%s' %(major_revision, minor_revision)
42
43distro_filename = 'anuga-%s.tgz' %revision
44
45# Export a clean directory tree from the working copy
46distro_dir = mktemp()
47s = 'mkdir %s' %distro_dir
48print s
49system(s)
50
51s = 'svn export anuga_core/source/anuga %s/anuga' %(distro_dir) 
52print s
53system(s)
54
55# Zip it up
56s = 'cd %s;tar cvfz %s *' %(distro_dir, distro_filename)
57print s
58system(s)
59
60# Clean up
61s = '/bin/rm -rf %s/anuga' %(distro_dir) 
62print s
63system(s)
64
65# Get validation_files as well
66s = 'svn export anuga_validation/okushiri_2005 %s/okushiri' %(distro_dir) 
67print s
68system(s)
69
70# Other validations in here!!!
71
72# Zip it up
73s = 'cd %s;tar cvfz anuga_validation-%s.tgz *'\
74    %(distro_dir, revision)
75print s
76system(s)
77
78# Clean up
79s = '/bin/rm -rf %s/okushiri' %(distro_dir) 
80print s
81system(s)
82
83# Copy anuga_viewer
84s = '/bin/cp ./anuga_core/source/anuga_viewer/distros/anuga_viewer_1.0.tgz %s'\
85    %(distro_dir)
86print s
87system(s)
88
89# Move tar files to release area
90
91release_dir = '~/anuga_release_%s' %revision
92s = 'mkdir %s' %release_dir
93try:
94    system(s)
95except:
96    pass
97
98s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir) 
99print s
100system(s)
101print 'Done'
102print
103print
104print 'The release files are in %s:' %release_dir
105system('ls -la %s' %release_dir)
Note: See TracBrowser for help on using the repository browser.