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