Changeset 8086
- Timestamp:
- Nov 25, 2010, 11:50:39 AM (14 years ago)
- Location:
- branches/anuga_1_2_1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/anuga_1_2_1/create_distribution.py
r7889 r8086 28 28 from anuga.abstract_2d_finite_volumes.util import get_revision_number 29 29 from anuga.abstract_2d_finite_volumes.util import store_version_info 30 from anuga.config import major_revision31 30 from dirs_to_distribute import dirmap 32 31 from anuga.utilities.data_audit_wrapper import IP_verified … … 38 37 raise Exception(msg) 39 38 40 def xlog(msg): 41 """Log a message and print to console.""" 42 43 print(msg) 44 #log(msg) 45 46 def do_cmd(cmd): 47 """Execute command. Ignore errors.""" 48 39 def do_cmd(cmd, blind=True): 40 """Execute command. Ignore errors if blind=True.""" 41 49 42 try: 50 43 xlog(cmd) 51 44 os.system(cmd) 52 45 except: 53 pass 54 55 56 # line separator 46 if not blind: 47 raise 48 49 50 def get_release_number(): 51 """Get release information and create release name. 52 53 Get release numbers from the current directory. 54 55 Returns a string which is of the form 'anuga-X-Y-Z' where X is the 56 major release number, Y is the minor and Z is the bug number. 57 """ 58 59 curr_dir = os.getcwd() 60 curr_dir = os.path.basename(curr_dir) 61 split_dir = curr_dir.split('_') 62 if len(split_dir) < 2: 63 abort('You must run this script in an ANUGA branch directory: ' 64 'anuga_X_Y[_Z].') 65 if split_dir[0] != 'anuga': 66 abort('You must run this script in an ANUGA branch directory: ' 67 'anuga_X_Y[_Z].') 68 69 major = split_dir[1] 70 if len(split_dir) < 3: 71 minor = '0' 72 else: 73 minor = split_dir[2] 74 75 if len(split_dir) < 4: 76 bug = '0' 77 else: 78 bug = split_dir[3] 79 80 return '%s.%s.%s' % (major, minor, bug) 81 82 83 def xlog(msg): 84 """Log a message and print to console.""" 85 86 print(msg) 87 #log(msg) 88 89 90 # line separator 57 91 lsep = '-' * 72 58 92 … … 65 99 66 100 svn_revision = get_revision_number() 67 revision = '%s_%s' % (major_revision, svn_revision) 68 xlog('Creating ANUGA revision %s' % revision)69 70 anuga_release_name = 'anuga-%s' % revision 101 102 anuga_release_number = get_release_number() 103 anuga_release_name = 'anuga-%s' % anuga_release_number 104 71 105 distro_filename = '%s.tgz' % anuga_release_name 106 107 xlog(lsep) 108 xlog('Creating %s' % anuga_release_name) 109 xlog(lsep) 72 110 73 111 ###### 74 112 # Create directory for this release. 75 113 # It will be named like 76 # anuga_release_1. 0beta_4824114 # anuga_release_1.2.3 77 115 ###### 78 116 79 117 release_area = os.path.join('~', 'anuga_releases') 80 118 release_area = os.path.expanduser(release_area) 81 do_cmd('mkdir %s' % release_area)82 119 do_cmd('mkdir -p %s' % release_area) 120 83 121 release_dir = os.path.join(release_area, anuga_release_name ) 84 do_cmd('mkdir %s' % release_dir)122 do_cmd('mkdir -p %s' % release_dir) 85 123 86 124 ###### … … 89 127 90 128 distro_dir = tempfile.mktemp() 91 do_cmd('mkdir %s' % distro_dir)129 do_cmd('mkdir -p %s' % distro_dir) 92 130 93 131 ###### … … 97 135 for source in dirmap: 98 136 destination = os.path.join(distro_dir, dirmap[source]) 99 137 100 138 do_cmd('svn export -r %d --quiet %s %s' 101 139 % (svn_revision, source, destination)) … … 115 153 116 154 ###### 117 # Compile and bundle up the LaTeX documentation 118 ###### 119 120 print('') 155 # Compile and bundle up the LaTeX documentation 156 ###### 157 121 158 print(lsep) 122 159 xlog('Preparing User Manual (see update_anuga_user_manual.log)') 123 160 print(lsep) 124 do_cmd('cd anuga_core/documentation/user_manual; '161 do_cmd('cd anuga_core/documentation/user_manual; ' 125 162 'python update_anuga_user_manual.py --no_html ' 126 '1>update_anuga_user_manual.log 2>/dev/null' )163 '1>update_anuga_user_manual.log 2>/dev/null', blind=False) 127 164 128 165 # Copy to distro_dir to become part of one tarball 129 release_name = 'anuga_user_manual-%s.pdf' % revision166 release_name = 'anuga_user_manual-%s.pdf' % anuga_release_number 130 167 do_cmd('/bin/mv anuga_core/documentation/user_manual/anuga_user_manual.pdf ' 131 '%s/%s' % (distro_dir, release_name))132 133 release_name = 'anuga_installation_guide-%s.pdf' % revision168 '%s/%s' % (distro_dir, release_name)) 169 170 release_name = 'anuga_installation_guide-%s.pdf' % anuga_release_number 134 171 do_cmd('/bin/mv anuga_core/documentation/user_manual/' 135 'anuga_installation_guide.pdf %s/%s' % (distro_dir, release_name) 136 137 release_name = 'anuga_whats_new-%s.pdf' % revision172 'anuga_installation_guide.pdf %s/%s' % (distro_dir, release_name)) 173 174 release_name = 'anuga_whats_new-%s.pdf' % anuga_release_number 138 175 do_cmd('/bin/mv anuga_core/documentation/user_manual/anuga_whats_new.pdf %s/%s' 139 % (distro_dir, release_name) 140 176 % (distro_dir, release_name)) 177 141 178 ###### 142 179 # Zip everything up 143 180 ###### 144 181 145 do_cmd('cd %s; tar cvfz %s *' % (distro_dir, distro_filename))182 do_cmd('cd %s; tar cfz %s *' % (distro_dir, distro_filename)) 146 183 147 184 ###### … … 155 192 ###### 156 193 157 do_cmd('/bin/rm -rf %s/*' % distro_dir) 158 159 ###### 160 # Generate Windows installer 161 ###### 194 # do_cmd('/bin/rm -rf %s/*' % distro_dir) 195 196 ###### 197 # Generate Windows installer config.sh 198 ###### 199 200 xlog('') 201 xlog(lsep) 202 xlog('Creating Windows installer files') 203 xlog(lsep) 162 204 163 205 root = os.getcwd() … … 176 218 177 219 # and unpack ANUGA into it 178 do_cmd('cd files/%s; tar x vfz %s/%s'220 do_cmd('cd files/%s; tar xfz %s/%s' 179 221 % (anuga_release_name, release_dir, distro_filename)) 180 222 … … 189 231 190 232 # Generate NSI file 191 create_config(revision, anuga_release_name, anuga_viewer_folder, python, 192 numpy, scientific_python, matplotlib, netcdf_folder, mingw) 193 194 # Package up files necessary to compile the installer on Windows and 233 create_config(anuga_release_number, anuga_release_name, anuga_viewer_folder, 234 python, numpy, scientific_python, matplotlib, netcdf_folder, 235 mingw) 236 237 # Package up files necessary to compile the installer on Windows and 195 238 # move to release area 196 239 # Cleanup in case there was something left from a previous attempt 197 240 do_cmd('cd %s; /bin/rm -rf windows_installer' % release_dir) 198 241 199 242 # Create subdirectories for windows installer 200 do_cmd('cd %s; mkdir windows_installer; mkdir windows_installer/files' 201 % release_dir) 243 do_cmd('cd %s; mkdir -p windows_installer/files' % release_dir) 202 244 203 245 # Copy installion scrips and imagery across … … 209 251 # Come back to starting directory 210 252 os.chdir(root) 211 253 212 254 # Grab license file from anuga_core and copy to installer 213 255 do_cmd('cp anuga_core/source/anuga/LICENSE.txt %s/windows_installer/files' 214 % release_dir 256 % release_dir) 215 257 216 258 xlog('NSI installer created') … … 228 270 print(lsep) 229 271 print('') 230 print('')231 232 272 233 273 ###### 234 274 # Copy release to various destinations 235 275 ###### 236 # FIXME (Ole): I don't think this is the way any more 237 # due to changes at SourceForge. 238 239 answer = raw_input('Do you want to upload this to sourceforge? Y/N [Y]') 240 if answer.lower() != 'n': 241 242 print 'Uploading to sourceforge' 243 244 import os, os.path 245 release_dir = os.path.expanduser(release_dir) 246 os.chdir(release_dir) 247 print 'Reading from', os.getcwd() 248 249 250 s = 'rsync -avP -e ssh *.* uniomni@frs.sourceforge.net:uploads/' 251 print s 252 os.system(s) 253 254 255 256 #from ftplib import FTP 257 #ftp = FTP('upload.sourceforge.net') 258 #print ftp.login() # Anonymous 259 #print ftp.cwd('incoming') 260 # 261 #for filename in os.listdir('.'): 262 # print 'Uploading %s... ' %filename, 263 # sys.stdout.flush() 264 # 265 # fid=open(filename, 'rb') 266 # print ftp.storbinary('STOR %s' %filename, fid) 267 # fid.close() 268 # 269 #print 'FTP done' 270 #print ftp.quit() 271 272 print 273 print lsep 274 print ' ********************* NOTE *************************' 275 print lsep 276 print 'To complete this release you must log into' 277 print 'http://sourceforge.net/projects/anuga as ANUGA admin' 278 print 'and complete the process by selecting File Releases ' 279 print 'in the admin menu there.' 280 print lsep 281 print 282 print 283 284 285 286 # Copy to the ANU 287 #s = 'rsync -avz %s/* ole@datamining.anu.edu.au:public_html/software/anuga/%s' %(release_dir, 'anuga_%s' %revision) 288 s = 'scp -r %s ole@datamining.anu.edu.au:public_html/software/anuga' %(release_dir) 289 print s 290 os.system(s) 291 292 276 277 # # Copy to the ANU 278 # #s = 'rsync -avz %s/* ole@datamining.anu.edu.au:public_html/software/anuga/%s' %(release_dir, 'anuga_%s' %revision) 279 # s = 'scp -r %s ole@datamining.anu.edu.au:public_html/software/anuga' %(release_dir) 280 # print s 281 # os.system(s) 282 293 283 ###### 294 284 # Throw away code to drop all files into the RAMP download area … … 304 294 print 'Attempt to rsync data to perlite and datamining' 305 295 # Copy to Georisk 306 s = 'rsync -avz %s/* onielsen@cyclone:georisk/downloads/ANUGA_install/%s' %(release_dir, 'anuga_%s' % revision) 296 s = ('rsync -avz %s/* onielsen@cyclone:georisk/downloads/ANUGA_install/%s' 297 % (release_dir, 'anuga_%s' % anuga_release_number)) 307 298 print s 308 299 os.system(s) 309 300 310 301 #os.system('scp %s/*.pdf onielsen@cyclone:/d/cit/1/cit/risk_assessment_methods_project/downloads/ANUGA_install' %release_dir)# 311 312 print 'Remember to update' 313 print ' anuga_whats_new.tex' 314 print ' sourceforge' 315 302 303 ###### 304 # Little reminders 305 ###### 306 307 xlog('Remember to update') 308 xlog(' anuga_whats_new.tex') 309 xlog(' sourceforge') 310 xlog(' code.google.com') -
branches/anuga_1_2_1/dirs_to_distribute.py
r7753 r8086 23 23 dirmap[join('anuga_validation', 'automated_validation_tests')] = None 24 24 #dirmap[join('anuga_core', 'documentation', 'user_manual', 'demos')] = None 25 dirmap[join('anuga_core', 'documentation', 'user_manual')] = None25 #dirmap[join('anuga_core', 'documentation', 'user_manual')] = None 26 26 27 27
Note: See TracChangeset
for help on using the changeset viewer.