Changeset 4531


Ignore:
Timestamp:
Jun 4, 2007, 4:58:55 PM (17 years ago)
Author:
ole
Message:

Automated upload to sourceforge in create_distribution.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • create_distribution.py

    r4384 r4531  
    2323from os import sep, system, remove
    2424from tempfile import mktemp
    25 from sys import platform
     25from sys import platform, stdout
    2626from anuga.utilities.system_tools import get_user_name, get_host_name
    2727from anuga.abstract_2d_finite_volumes.util import get_revision_number
     
    3838major_revision = '1.0beta'
    3939
    40 
    41 # Refresh sandpit and retrieve svn revision number
    42 # from last line in svn update output
    43 #filename = mktemp() + '.txt'
    44 #s = 'svn update > %s' %filename
    45 #print s
    46 #system(s)
    47 #
    48 #fid = open(filename)
    49 #last_line = fid.readlines()[-1]
    50 #remove(filename)
    51 #if not (last_line.startswith('At revision') or\
    52 #        last_line.startswith('Updated to revision')):
    53 #    msg = 'Unexpected output from svn up: %s' %last_line
    54 #    raise Exception, msg   
    55 #
    56 #fields = last_line.split()
    57 #svn_revision = fields[-1][:-1]
    58 
    59 # Get revision number and create
     40# line separator
     41lsep = '----------------------------------------------------------------------'
     42
     43
     44# Get svn revision number and create
    6045# file with version info for release.
    6146# This will mean that the version currently checked out is
     
    176161
    177162#-----------------------------
    178 # Copy anuga_viewer
    179 s = '/bin/cp ./anuga_core/source/anuga_viewer/distros/anuga_viewer_1.0.tgz %s'\
    180     %(distro_dir)
    181 print s
    182 system(s)
    183 
    184 # Move distro to release area
    185 s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir)
    186 print s
    187 system(s)
     163# Copy and rename anuga_viewer
     164s = '/bin/cp ./anuga_core/source/anuga_viewer/distros/anuga_viewer_1.0.tgz %s/anuga_viewer-%s.tgz' %(distro_dir, revision)
     165print s
     166system(s)
     167
     168
     169# Move viewer to release area
     170s = '/bin/mv %s/*.tgz %s' %(distro_dir, release_dir)
     171print s
     172system(s)
     173
     174
    188175
    189176#-----------------------------
    190177# Hey, why not compile and bundle up the LaTeX documentation as well
    191178
     179print
     180print lsep
     181print 'Preparing User Manual (see update_anuga_user_manual.log)'
     182print lsep
    192183s = 'cd anuga_core/documentation/user_manual;'
    193184s += 'python update_anuga_user_manual.py --no_html'
    194185print s
    195 system(s)
     186system(s + ' 1>update_anuga_user_manual.log 2>/dev/null')
    196187
    197188release_name = 'anuga_user_manual-%s.pdf' %revision
     
    201192system(s)
    202193
    203 
    204194release_name = 'anuga_installation_guide-%s.pdf' %revision
    205195s = '/bin/mv anuga_core/documentation/user_manual/anuga_installation_guide.pdf %s/%s' %(release_dir, release_name)   
     
    209199
    210200
    211 
    212 #-----------------------------
     201#-----------------------------
     202
    213203print 'Done'
    214204print
    215205print
     206print lsep
    216207print 'The release files are in %s:' %release_dir
    217208system('ls -la %s' %release_dir)
     209print lsep
     210print
     211print
     212
     213answer = raw_input('Do you want to upload this to sourceforge? Y/N [Y]')
     214if answer.lower() != 'n':
     215   
     216    #------------------------------
     217    print 'Uploading to sourceforge'
     218
     219
     220    import os, os.path
     221    release_dir = os.path.expanduser(release_dir)
     222    os.chdir(release_dir)
     223    print 'Reading from', os.getcwd()
     224
     225
     226    from ftplib import FTP
     227    ftp = FTP('upload.sourceforge.net')
     228    print ftp.login() # Anonymous
     229    print ftp.cwd('incoming')
     230
     231
     232    for filename in os.listdir('.'):
     233        print 'Uploading %s... ' %filename,
     234        stdout.flush()
     235
     236        fid=open(filename, 'rb')
     237        print ftp.storbinary('STOR %s' %filename, fid)
     238        fid.close()
     239
     240    print 'FTP done'
     241    print ftp.quit()
     242
     243    print
     244    print lsep
     245    print '    ********************* NOTE *************************'
     246    print lsep
     247    print 'To complete this release you must log into'
     248    print 'http://sourceforge.net/projects/anuga as ANUGA admin'
     249    print 'and complete the process by selecting File Releases '
     250    print 'in the admin menu there.'
     251    print lsep
     252    print
     253    print
     254   
    218255
    219256
     
    225262if get_user_name() == 'ole' and get_host_name() == 'nautilus':
    226263
     264    print 'Attempt to rsync data to perlite and datamining'
    227265    # Copy to RAMP
    228266    s = 'rsync -avz %s/* onielsen@cyclone:/d/cit/1/cit/natural_hazard_impacts/downloads/ANUGA_install/%s' %(release_dir, 'anuga_%s' %revision)
     
    235273   
    236274    # Copy to the ANU
    237 
    238     s = 'rsync -avz %s/* ole@datamining.anu.edu.au:public_html/software/anuga/%s' %(release_dir, 'anuga_%s' %revision)
    239     print s
    240     system(s)
    241    
    242    
     275    #s = 'rsync -avz %s/* ole@datamining.anu.edu.au:public_html/software/anuga/%s' %(release_dir, 'anuga_%s' %revision)
     276    #print s
     277    #system(s)
     278   
     279   
Note: See TracChangeset for help on using the changeset viewer.