[5779] | 1 | #!/usr/bin/env python |
---|
| 2 | # |
---|
| 3 | # Release version as tagged by |
---|
| 4 | # cvs tag release-x-y-z |
---|
| 5 | |
---|
| 6 | import sys, os, string, os.path, time |
---|
| 7 | |
---|
| 8 | import pypar |
---|
| 9 | try: |
---|
| 10 | date = pypar.__date__ |
---|
| 11 | except: |
---|
| 12 | print 'WARNING: Could not obtain __date__ from pypar.py' |
---|
| 13 | date = time.ctime() |
---|
| 14 | |
---|
| 15 | rev = pypar.__version__ |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | package = 'pypar' |
---|
| 19 | destination = os.path.expanduser('~/public_html/pypar') |
---|
| 20 | |
---|
| 21 | # FIXME: temporarily commented out. Need to rewrite for Subversion. |
---|
| 22 | # |
---|
| 23 | # Get tag to release |
---|
| 24 | # |
---|
| 25 | #if len(sys.argv) > 1: |
---|
| 26 | # release = sys.argv[1] |
---|
| 27 | #else: |
---|
| 28 | # from popen2 import popen2 |
---|
| 29 | # output, input = popen2('cvs log 2>/dev/null') |
---|
| 30 | # input.close() |
---|
| 31 | # lines = output.readlines() |
---|
| 32 | # |
---|
| 33 | # found = 0 |
---|
| 34 | # for line in lines: |
---|
| 35 | # #print line, |
---|
| 36 | # |
---|
| 37 | # if found: |
---|
| 38 | # tag, revision = line.split(':') |
---|
| 39 | # tag = tag.strip() |
---|
| 40 | # print 'Found tag %s corresponding to CVS revision %s\n'\ |
---|
| 41 | # %(tag, revision.strip()) |
---|
| 42 | # break |
---|
| 43 | # |
---|
| 44 | # if string.find(line, 'symbolic names:') == 0: |
---|
| 45 | # found = 1 |
---|
| 46 | # |
---|
| 47 | # |
---|
| 48 | #i = string.find(tag,'-') |
---|
| 49 | #rev = string.replace( tag[i:], '-', '_' ) |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | curdir = os.getcwd() |
---|
| 54 | os.chdir('/tmp') |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | # Export a clean directory |
---|
| 58 | #s = 'cvs export -r %s %s' %(tag, package) |
---|
| 59 | s = 'svn export %s %s' %(curdir, package) |
---|
| 60 | print s |
---|
| 61 | os.system(s) |
---|
| 62 | |
---|
| 63 | #import sys; sys.exit() |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | release_name = package + "_" + rev |
---|
| 67 | s = 'mv %s %s' %(package, release_name) |
---|
| 68 | print s |
---|
| 69 | os.system(s) |
---|
| 70 | |
---|
| 71 | # Create installation tree |
---|
| 72 | |
---|
| 73 | s = 'mkdir %s/lib %s/lib/pypar %s/examples' %((release_name,)*3) |
---|
| 74 | print s |
---|
| 75 | os.system(s) |
---|
| 76 | |
---|
| 77 | #cleanup dev stuff that shouldn't go into package |
---|
| 78 | s = '/bin/rm %s/install.py %s/compile.py %s/Makefile' %((release_name,)*3) |
---|
| 79 | print s |
---|
| 80 | os.system(s) |
---|
| 81 | |
---|
| 82 | s = 'mv %s/pypar.py %s/lib/pypar' %((release_name,)*2) |
---|
| 83 | print s |
---|
| 84 | os.system(s) |
---|
| 85 | |
---|
| 86 | s = 'mv %s/__init__.py %s/lib/pypar' %((release_name,)*2) |
---|
| 87 | print s |
---|
| 88 | os.system(s) |
---|
| 89 | |
---|
| 90 | s = 'mv %s/mpiext.c %s/lib/pypar' %((release_name,)*2) |
---|
| 91 | print s |
---|
| 92 | os.system(s) |
---|
| 93 | |
---|
| 94 | s = 'mv %s/*.py %s/examples' %((release_name,)*2) |
---|
| 95 | print s |
---|
| 96 | os.system(s) |
---|
| 97 | |
---|
| 98 | s = 'mv %s/examples/setup.py %s' %((release_name,)*2) |
---|
| 99 | print s |
---|
| 100 | os.system(s) |
---|
| 101 | |
---|
| 102 | s = 'mv %s/pytiming %s/examples' %((release_name,)*2) |
---|
| 103 | print s |
---|
| 104 | os.system(s) |
---|
| 105 | |
---|
| 106 | s = 'mv %s/ring_example.py %s/examples' %((release_name,)*2) |
---|
| 107 | print s |
---|
| 108 | os.system(s) |
---|
| 109 | |
---|
| 110 | s = 'mv %s/runpytiming %s/examples' %((release_name,)*2) |
---|
| 111 | print s |
---|
| 112 | os.system(s) |
---|
| 113 | |
---|
| 114 | s = 'mv %s/ctiming.c %s/examples' %((release_name,)*2) |
---|
| 115 | print s |
---|
| 116 | os.system(s) |
---|
| 117 | |
---|
| 118 | # Make tarball and copy to destination |
---|
| 119 | s = 'tar cvfz %s.tgz %s' %(release_name, release_name) |
---|
| 120 | print s |
---|
| 121 | os.system(s) |
---|
| 122 | |
---|
| 123 | s = 'cp %s.tgz %s' %(release_name, destination) |
---|
| 124 | print s |
---|
| 125 | os.system(s) |
---|
| 126 | |
---|
| 127 | s = 'cp %s/lib/pypar/pypar.py %s' %(release_name, destination) |
---|
| 128 | print s |
---|
| 129 | os.system(s) |
---|
| 130 | |
---|
| 131 | s = 'cp %s/lib/pypar/mpiext.c %s' %(release_name, destination) |
---|
| 132 | print s |
---|
| 133 | os.system(s) |
---|
| 134 | |
---|
| 135 | s = 'cp %s/examples/pytiming %s' %(release_name, destination) |
---|
| 136 | print s |
---|
| 137 | os.system(s) |
---|
| 138 | |
---|
| 139 | s = 'cp %s/examples/ctiming.c %s' %(release_name, destination) |
---|
| 140 | print s |
---|
| 141 | os.system(s) |
---|
| 142 | |
---|
| 143 | s = 'cp %s/examples/ring_example.py %s' %(release_name, destination) |
---|
| 144 | print s |
---|
| 145 | os.system(s) |
---|
| 146 | |
---|
| 147 | s = 'cp %s/README %s' %(release_name, destination) |
---|
| 148 | print s |
---|
| 149 | os.system(s) |
---|
| 150 | |
---|
| 151 | s = 'cp %s/DOC %s' %(release_name, destination) |
---|
| 152 | print s |
---|
| 153 | os.system(s) |
---|
| 154 | |
---|
| 155 | # Update web page |
---|
| 156 | # |
---|
| 157 | print 'Updating WEB page ' + destination |
---|
| 158 | input = open(destination + '/' + 'index.src', 'r') |
---|
| 159 | output = open(destination + '/' + 'index.php', 'w') |
---|
| 160 | |
---|
| 161 | output.write('<!-- AUTOMATICALLY GENERATED - EDIT index.src instead -->\n') |
---|
| 162 | for line in input.readlines(): |
---|
| 163 | line = string.replace(line, '<date>', date) |
---|
| 164 | output.write(string.replace(line,'<filename>',release_name+'.tgz')) |
---|
| 165 | output.close() |
---|
| 166 | |
---|
| 167 | #os.system('mv %s.tgz /home/web/dm_web/software/%s' %(release_name, package)) |
---|
| 168 | #os.system('cp %s/README /home/web/dm_web/software/%s' %(release_name, package)) |
---|
| 169 | #os.system('cp %s/DOC /home/web/dm_web/software/%s' %(release_name, package)) |
---|
| 170 | |
---|
| 171 | # Make soft link |
---|
| 172 | # |
---|
| 173 | s = 'cd %s; rm pypar.tgz; ln -s %s.tgz pypar.tgz' %(destination, release_name) |
---|
| 174 | print s |
---|
| 175 | os.system(s) |
---|
| 176 | |
---|
| 177 | #Cleanup |
---|
| 178 | s = '/bin/rm -f -r %s' %release_name |
---|
| 179 | print s |
---|
| 180 | os.system(s) |
---|
| 181 | |
---|
| 182 | |
---|