Changeset 8086


Ignore:
Timestamp:
Nov 25, 2010, 11:50:39 AM (13 years ago)
Author:
habili
Message:

Updated

Location:
branches/anuga_1_2_1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/anuga_1_2_1/create_distribution.py

    r7889 r8086  
    2828from anuga.abstract_2d_finite_volumes.util import get_revision_number
    2929from anuga.abstract_2d_finite_volumes.util import store_version_info
    30 from anuga.config import major_revision
    3130from dirs_to_distribute import dirmap
    3231from anuga.utilities.data_audit_wrapper import IP_verified
     
    3837    raise Exception(msg)
    3938
    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    
     39def do_cmd(cmd, blind=True):
     40    """Execute command.  Ignore errors if blind=True."""
     41
    4942    try:
    5043        xlog(cmd)
    5144        os.system(cmd)
    5245    except:
    53         pass
    54 
    55 
    56 # line separator
     46        if not blind:
     47            raise
     48
     49
     50def 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
     83def xlog(msg):
     84    """Log a message and print to console."""
     85
     86    print(msg)
     87    #log(msg)
     88
     89
     90# line separator
    5791lsep = '-' * 72
    5892
     
    6599
    66100svn_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
     102anuga_release_number = get_release_number()
     103anuga_release_name = 'anuga-%s' % anuga_release_number
     104
    71105distro_filename = '%s.tgz' % anuga_release_name
     106
     107xlog(lsep)
     108xlog('Creating %s' % anuga_release_name)
     109xlog(lsep)
    72110
    73111######
    74112# Create directory for this release.
    75113# It will be named like
    76 #        anuga_release_1.0beta_4824
     114#        anuga_release_1.2.3
    77115######
    78116
    79117release_area = os.path.join('~', 'anuga_releases')
    80118release_area = os.path.expanduser(release_area)
    81 do_cmd('mkdir %s' % release_area)
    82    
     119do_cmd('mkdir -p %s' % release_area)
     120
    83121release_dir = os.path.join(release_area, anuga_release_name )
    84 do_cmd('mkdir %s' % release_dir)
     122do_cmd('mkdir -p %s' % release_dir)
    85123
    86124######
     
    89127
    90128distro_dir = tempfile.mktemp()
    91 do_cmd('mkdir %s' % distro_dir)
     129do_cmd('mkdir -p %s' % distro_dir)
    92130
    93131######
     
    97135for source in dirmap:
    98136    destination = os.path.join(distro_dir, dirmap[source])
    99    
     137
    100138    do_cmd('svn export -r %d --quiet %s %s'
    101139           % (svn_revision, source, destination))
     
    115153
    116154######
    117 # Compile and bundle up the LaTeX documentation
    118 ######
    119 
    120 print('')
     155# Compile and bundle up the LaTeX documentation
     156######
     157
    121158print(lsep)
    122159xlog('Preparing User Manual (see update_anuga_user_manual.log)')
    123160print(lsep)
    124 do_cmd('cd anuga_core/documentation/user_manual;'
     161do_cmd('cd anuga_core/documentation/user_manual; '
    125162       '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)
    127164
    128165# Copy to distro_dir to become part of one tarball
    129 release_name = 'anuga_user_manual-%s.pdf' % revision
     166release_name = 'anuga_user_manual-%s.pdf' % anuga_release_number
    130167do_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' % revision
     168           '%s/%s' % (distro_dir, release_name))
     169
     170release_name = 'anuga_installation_guide-%s.pdf' % anuga_release_number
    134171do_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' % revision
     172           'anuga_installation_guide.pdf %s/%s' % (distro_dir, release_name))
     173
     174release_name = 'anuga_whats_new-%s.pdf' % anuga_release_number
    138175do_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
    141178######
    142179# Zip everything up
    143180######
    144181
    145 do_cmd('cd %s;tar cvfz %s *' % (distro_dir, distro_filename))
     182do_cmd('cd %s; tar cfz %s *' % (distro_dir, distro_filename))
    146183
    147184######
     
    155192######
    156193
    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
     200xlog('')
     201xlog(lsep)
     202xlog('Creating Windows installer files')
     203xlog(lsep)
    162204
    163205root = os.getcwd()
     
    176218
    177219# and unpack ANUGA into it
    178 do_cmd('cd files/%s; tar xvfz %s/%s'
     220do_cmd('cd files/%s; tar xfz %s/%s'
    179221       % (anuga_release_name, release_dir, distro_filename))
    180222
     
    189231
    190232# 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
     233create_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
    195238# move to release area
    196239# Cleanup in case there was something left from a previous attempt
    197240do_cmd('cd %s; /bin/rm -rf windows_installer' % release_dir)
    198    
     241
    199242# Create subdirectories for windows installer
    200 do_cmd('cd %s; mkdir windows_installer; mkdir windows_installer/files'
    201        % release_dir)
     243do_cmd('cd %s; mkdir -p windows_installer/files' % release_dir)
    202244
    203245# Copy installion scrips and imagery across
     
    209251# Come back to starting directory
    210252os.chdir(root)
    211                                                      
     253
    212254# Grab license file from anuga_core and copy to installer
    213255do_cmd('cp anuga_core/source/anuga/LICENSE.txt %s/windows_installer/files'
    214        % release_dir                                                       )
     256       % release_dir)
    215257
    216258xlog('NSI installer created')
     
    228270print(lsep)
    229271print('')
    230 print('')
    231 
    232272
    233273######
    234274# Copy release to various destinations
    235275######
    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
    293283######
    294284# Throw away code to drop all files into the RAMP download area
     
    304294    print 'Attempt to rsync data to perlite and datamining'
    305295    # 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))
    307298    print s
    308299    os.system(s)
    309    
     300
    310301    #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
     307xlog('Remember to update')
     308xlog('    anuga_whats_new.tex')
     309xlog('    sourceforge')
     310xlog('    code.google.com')
  • branches/anuga_1_2_1/dirs_to_distribute.py

    r7753 r8086  
    2323dirmap[join('anuga_validation', 'automated_validation_tests')] = None
    2424#dirmap[join('anuga_core', 'documentation', 'user_manual', 'demos')] = None
    25 dirmap[join('anuga_core', 'documentation', 'user_manual')] = None
     25#dirmap[join('anuga_core', 'documentation', 'user_manual')] = None
    2626
    2727
Note: See TracChangeset for help on using the changeset viewer.